結果
| 問題 | 
                            No.2080 Simple Nim Query
                             | 
                    
| コンテスト | |
| ユーザー | 
                             やう
                         | 
                    
| 提出日時 | 2022-09-25 22:13:55 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 902 bytes | 
| コンパイル時間 | 1,608 ms | 
| コンパイル使用メモリ | 171,124 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2024-12-22 14:43:19 | 
| 合計ジャッジ時間 | 4,046 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 1 WA * 1 RE * 6 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using P=pair<ll,ll>;
using V=vector<ll>;
#define rep(i,n) for(ll i=0;i<n;i++)
#define REP(i,n) for(ll i=1;i<=n;i++)
int n=1;
V k(202020);
void update(int i,int x){
    i+=n-1;
    k[i]=x;
    while(i){
        i=(i-1)/2;
        k[i]=k[i*2+1]+k[i*2+2];
    }
}
int query(int a,int b,int i,int l,int r){
    if(b<=l||r<=a) return 0;
    if(a<=l&&r<=b) return k[i];
    return query(a,b,i*2+1,l,(l+r)/2)+query(a,b,i*2+2,(l+r)/2,r);
}
int main(){
    int _n,q,count=0;
    cin >> _n >> q;
    while(n<=_n) n*=2;
    V a(_n);
    rep(i,_n){
        cin >> a[i];
        update(i,(0<i&&a[i]==1));
    }
    rep(i,q){
        int t,x,y;
        cin >> t >> x >> y;
        x--;
        if(t==1) update(x,(0<x&&y==1));
        else if(query(x,y,0,0,n)%2) cout << "S" << endl;
        else cout << "F" << endl;
    }
}
            
            
            
        
            
やう