Educational Codeforces Round 72 E問題 - Sum Queries?

Source

Educational Codeforces Round 72 E問題
Problem description

問題概要

省略

解法

省略

cLayversion 20190914-1)のコード

C++に変換後のコードはこちら

//no-unlocked
int N, M, A[2d5];
int Q, X, Y;
int d[9];

void cal(int x){
  rep(i,9) d[i] = x%10, x/=10;
}

{
  ll res;
  pair<int,int> p;
  
  rd(N,M,A(N));
  segtree_Point_Minval2<int> t[9];
  rep(i,9){
    t[i].malloc(N);
    t[i].setN(N);
  }
  rep(i,N){
    cal(A[i]);
    rep(j,9) t[j][i] = if[d[j], A[i], int_inf];
  }
  rep(i,9) t[i].build();
  rep(M){
    rd(Q,X,Y);
    if(Q==1){
      X--;
      cal(Y);
      rep(j,9) t[j].change(X, if[d[j], Y, int_inf]);
    } else {
      X--; Y--;
      res = ll_inf;

      rep(j,9){
        p = t[j].getMinVal2(X, Y+1);
        if(p.first < int_inf && p.second < int_inf) res <?= p.first + p.second;
      }

      if(res==ll_inf) res = -1;
      wt(res);
    }
  }
}

Current time: 2024年04月26日19時50分01秒
Last modified: 2019年09月15日13時19分01秒 (by laycrs)
Tags: Competitive_Programming_Incomplete Codeforces
トップページに戻る

Logged in as: unknown user (not login)

ログイン: