結果
問題 | No.2080 Simple Nim Query |
ユーザー |
![]() |
提出日時 | 2022-09-25 22:23:18 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 882 bytes |
コンパイル時間 | 1,672 ms |
コンパイル使用メモリ | 168,972 KB |
実行使用メモリ | 12,752 KB |
最終ジャッジ日時 | 2024-12-22 14:45:35 |
合計ジャッジ時間 | 6,157 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 3 WA * 5 |
ソースコード
#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(1001001); 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,(a[i]==1)); } rep(i,q){ int t,x,y; cin >> t >> x >> y; if(t==1) update(x-1,(y==1)); else if(query(x,y,0,0,n)%2) cout << "S" << endl; else cout << "F" << endl; } }