結果

問題 No.1439 Let's Compare!!!!
ユーザー zumin
提出日時 2021-03-26 22:10:30
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 417 ms / 2,000 ms
コード長 843 bytes
コンパイル時間 815 ms
コンパイル使用メモリ 79,264 KB
実行使用メモリ 8,280 KB
最終ジャッジ日時 2024-11-29 08:47:58
合計ジャッジ時間 5,686 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <atcoder/segtree>

using namespace std;
using namespace atcoder;

int op(int a,int b) {return abs(a)+abs(b);}
int e() {return 0;}
int chk(int x){ return x==0;}
int main(){
    int n;
    cin>>n;
    vector<int> s,t,diff;
    string ss,st;
    cin>>ss>>st;
    for(auto c:ss) s.push_back(c-'0');
    for(auto c:st) t.push_back(c-'0');
    for(int i=0;i<n;i++) diff.push_back(s[i]-t[i]);
    
    segtree<int,op,e> seg(diff);
    int q;
    cin>>q;
    for(int i=0;i<q;i++){
        char c;
        int x,y;
        cin>>c>>x>>y;
        if(c=='S'){
            s[x-1]=y;
        }else{
            t[x-1]=y;
        }
        seg.set(x-1,s[x-1]-t[x-1]);
        int p=seg.max_right(0,chk);
        if(p==n) cout<<"="<<endl;
        else cout<<((seg.get(p)>0)?">":"<")<<endl;
    }

    return 0;
}
0