結果
問題 | No.2165 Let's Play Nim! |
ユーザー | daiota |
提出日時 | 2022-12-16 03:33:35 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 179 ms / 2,000 ms |
コード長 | 2,145 bytes |
コンパイル時間 | 857 ms |
コンパイル使用メモリ | 94,584 KB |
実行使用メモリ | 25,348 KB |
平均クエリ数 | 863.56 |
最終ジャッジ日時 | 2024-04-27 07:42:09 |
合計ジャッジ時間 | 15,460 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 23 ms
25,196 KB |
testcase_01 | AC | 125 ms
24,812 KB |
testcase_02 | AC | 133 ms
24,812 KB |
testcase_03 | AC | 82 ms
25,324 KB |
testcase_04 | AC | 21 ms
25,196 KB |
testcase_05 | AC | 25 ms
25,196 KB |
testcase_06 | AC | 25 ms
24,940 KB |
testcase_07 | AC | 24 ms
24,940 KB |
testcase_08 | AC | 81 ms
25,208 KB |
testcase_09 | AC | 25 ms
25,208 KB |
testcase_10 | AC | 28 ms
25,196 KB |
testcase_11 | AC | 126 ms
24,556 KB |
testcase_12 | AC | 114 ms
25,196 KB |
testcase_13 | AC | 20 ms
25,196 KB |
testcase_14 | AC | 24 ms
25,196 KB |
testcase_15 | AC | 21 ms
25,196 KB |
testcase_16 | AC | 101 ms
25,196 KB |
testcase_17 | AC | 51 ms
25,196 KB |
testcase_18 | AC | 179 ms
25,196 KB |
testcase_19 | AC | 21 ms
25,208 KB |
testcase_20 | AC | 25 ms
25,208 KB |
testcase_21 | AC | 47 ms
24,964 KB |
testcase_22 | AC | 39 ms
25,220 KB |
testcase_23 | AC | 36 ms
24,964 KB |
testcase_24 | AC | 33 ms
24,836 KB |
testcase_25 | AC | 71 ms
25,348 KB |
testcase_26 | AC | 131 ms
25,064 KB |
testcase_27 | AC | 38 ms
25,324 KB |
testcase_28 | AC | 59 ms
24,940 KB |
testcase_29 | AC | 21 ms
24,556 KB |
testcase_30 | AC | 21 ms
25,196 KB |
testcase_31 | AC | 20 ms
25,196 KB |
testcase_32 | AC | 81 ms
25,184 KB |
evil_2_big_1.txt | AC | 1,647 ms
24,556 KB |
evil_2_big_2.txt | TLE | - |
evil_2_big_3.txt | AC | 1,587 ms
25,196 KB |
evil_big_1.txt | AC | 1,627 ms
25,220 KB |
evil_big_2.txt | AC | 1,898 ms
25,348 KB |
evil_big_3.txt | AC | 1,921 ms
25,460 KB |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:127:24: warning: 'q' may be used uninitialized [-Wmaybe-uninitialized] 127 | x=x^a[q]; | ~~~^ main.cpp:118:21: note: 'q' was declared here 118 | int q; | ^ main.cpp:110:21: warning: 'p' may be used uninitialized [-Wmaybe-uninitialized] 110 | int p; | ^ main.cpp:70:16: warning: 'q' may be used uninitialized [-Wmaybe-uninitialized] 70 | x=x^a[q]; | ~~~^ main.cpp:61:13: note: 'q' was declared here 61 | int q; | ^ main.cpp:53:13: warning: 'p' may be used uninitialized [-Wmaybe-uninitialized] 53 | int p; | ^
ソースコード
#include<iostream> #include<sstream> #include<fstream> #include<string> #include<vector> #include<deque> #include<queue> #include<stack> #include<set> #include<map> #include<algorithm> #include<functional> #include<utility> #include<bitset> #include<cmath> #include<cstdlib> #include<ctime> #include<cstdio> using namespace std; #define REP(i,n) for(int i=0;i<int(n);i++) #define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++) typedef long long ll; typedef pair<int,int> P; int a[80000]; int main(void){ int i,j; cin.tie(0); ios_base::sync_with_stdio(false); int n,x=0; cin >> n; for (i=1;i<=n;i++){ cin >>a[i]; x^=a[i]; } int t; if(x!=0) t=1; else t=0; cout << t << endl; cout.flush(); if(t==1){ while(1){ int p; for(j=14;j>=0;j--){ if(x & (1<<j)){ p=j; break; } } int q; for(i=1;i<=n;i++){ if(a[i] & (1<<p)){ q=i; break; } } int s=x; x=x^a[q]; int k=a[q]-(a[q]^s); a[q]=s^a[q]; x=x^a[q]; cout << q << ' ' << k << endl; cout.flush(); int r; cin >> r; if(r==-1) return 0; int c,d; cin >> c >> d; x=x^a[c]; a[c]=a[c]-d; x=x^a[c]; cin >> r; if(r==-1) return 0; } }else{ while(1){ int c,d; cin >> c >> d; x=x^a[c]; a[c]=a[c]-d; x=x^a[c]; int r; cin >> r; if(r==-1) return 0; int p; for(j=14;j>=0;j--){ if(x & (1<<j)){ p=j; break; } } int q; for(i=1;i<=n;i++){ if(a[i] & (1<<p)){ q=i; break; } } int s=x; x=x^a[q]; int k=a[q]-(a[q]^s); a[q]=s^a[q]; x=x^a[q]; cout << q << ' ' << k << endl; cout.flush(); cin >> r; if(r==-1) return 0; } } return 0; }