結果

問題 No.1439 Let's Compare!!!!
ユーザー zuminzumin
提出日時 2021-03-26 22:10:30
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 407 ms / 2,000 ms
コード長 843 bytes
コンパイル時間 1,287 ms
コンパイル使用メモリ 76,652 KB
実行使用メモリ 8,004 KB
最終ジャッジ日時 2023-08-19 15:21:15
合計ジャッジ時間 5,990 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 7 ms
4,380 KB
testcase_08 AC 13 ms
4,380 KB
testcase_09 AC 5 ms
4,376 KB
testcase_10 AC 388 ms
7,824 KB
testcase_11 AC 398 ms
7,888 KB
testcase_12 AC 394 ms
7,848 KB
testcase_13 AC 394 ms
7,976 KB
testcase_14 AC 396 ms
7,932 KB
testcase_15 AC 407 ms
8,004 KB
testcase_16 AC 398 ms
7,876 KB
testcase_17 AC 403 ms
7,932 KB
testcase_18 AC 368 ms
7,928 KB
権限があれば一括ダウンロードができます

ソースコード

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