結果
問題 | No.1306 Exactly 2 Digits |
ユーザー | 👑 Nachia |
提出日時 | 2020-12-03 20:51:18 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,093 bytes |
コンパイル時間 | 2,188 ms |
コンパイル使用メモリ | 205,520 KB |
実行使用メモリ | 25,764 KB |
平均クエリ数 | 1123.55 |
最終ジャッジ日時 | 2024-07-17 09:03:33 |
合計ジャッジ時間 | 23,629 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 26 ms
24,812 KB |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | AC | 24 ms
24,836 KB |
testcase_07 | AC | 24 ms
25,220 KB |
testcase_08 | AC | 24 ms
24,836 KB |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | AC | 23 ms
25,220 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | AC | 24 ms
24,940 KB |
testcase_17 | WA | - |
testcase_18 | AC | 25 ms
24,812 KB |
testcase_19 | WA | - |
testcase_20 | AC | 25 ms
24,556 KB |
testcase_21 | AC | 25 ms
25,052 KB |
testcase_22 | WA | - |
testcase_23 | AC | 24 ms
24,812 KB |
testcase_24 | AC | 24 ms
24,812 KB |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | AC | 25 ms
24,812 KB |
testcase_34 | AC | 26 ms
24,556 KB |
testcase_35 | WA | - |
testcase_36 | AC | 25 ms
24,812 KB |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | AC | 26 ms
24,940 KB |
testcase_44 | AC | 27 ms
24,556 KB |
testcase_45 | AC | 27 ms
24,556 KB |
testcase_46 | WA | - |
testcase_47 | AC | 29 ms
25,196 KB |
testcase_48 | WA | - |
testcase_49 | AC | 30 ms
24,940 KB |
testcase_50 | AC | 31 ms
24,800 KB |
testcase_51 | WA | - |
testcase_52 | AC | 35 ms
24,556 KB |
testcase_53 | WA | - |
testcase_54 | WA | - |
testcase_55 | AC | 39 ms
25,196 KB |
testcase_56 | AC | 39 ms
24,940 KB |
testcase_57 | AC | 42 ms
24,556 KB |
testcase_58 | AC | 44 ms
24,812 KB |
testcase_59 | WA | - |
testcase_60 | WA | - |
testcase_61 | WA | - |
testcase_62 | AC | 55 ms
25,196 KB |
testcase_63 | AC | 57 ms
24,800 KB |
testcase_64 | WA | - |
testcase_65 | AC | 57 ms
24,940 KB |
testcase_66 | WA | - |
testcase_67 | WA | - |
testcase_68 | WA | - |
testcase_69 | WA | - |
testcase_70 | AC | 70 ms
24,556 KB |
testcase_71 | AC | 71 ms
25,196 KB |
testcase_72 | WA | - |
testcase_73 | WA | - |
testcase_74 | AC | 81 ms
24,556 KB |
testcase_75 | WA | - |
testcase_76 | AC | 87 ms
25,180 KB |
testcase_77 | AC | 95 ms
25,196 KB |
testcase_78 | WA | - |
testcase_79 | AC | 106 ms
25,196 KB |
testcase_80 | WA | - |
testcase_81 | WA | - |
testcase_82 | WA | - |
testcase_83 | WA | - |
testcase_84 | WA | - |
testcase_85 | AC | 131 ms
25,196 KB |
testcase_86 | WA | - |
testcase_87 | AC | 114 ms
25,196 KB |
testcase_88 | WA | - |
testcase_89 | WA | - |
testcase_90 | WA | - |
testcase_91 | WA | - |
testcase_92 | WA | - |
testcase_93 | AC | 123 ms
25,196 KB |
testcase_94 | AC | 106 ms
24,812 KB |
testcase_95 | WA | - |
testcase_96 | WA | - |
testcase_97 | AC | 101 ms
24,940 KB |
testcase_98 | AC | 97 ms
24,940 KB |
testcase_99 | WA | - |
testcase_100 | AC | 116 ms
24,556 KB |
testcase_101 | AC | 124 ms
24,812 KB |
testcase_102 | WA | - |
testcase_103 | WA | - |
testcase_104 | AC | 109 ms
24,940 KB |
testcase_105 | WA | - |
testcase_106 | WA | - |
testcase_107 | WA | - |
testcase_108 | WA | - |
testcase_109 | WA | - |
testcase_110 | AC | 102 ms
24,940 KB |
testcase_111 | AC | 105 ms
25,196 KB |
testcase_112 | AC | 98 ms
25,452 KB |
testcase_113 | AC | 132 ms
25,196 KB |
testcase_114 | WA | - |
testcase_115 | AC | 111 ms
24,556 KB |
testcase_116 | AC | 140 ms
24,812 KB |
testcase_117 | WA | - |
testcase_118 | WA | - |
testcase_119 | WA | - |
testcase_120 | AC | 98 ms
24,556 KB |
testcase_121 | AC | 120 ms
25,452 KB |
testcase_122 | WA | - |
ソースコード
#include<bits/stdc++.h> using namespace std; using LL=long long; using ULL=unsigned long long; #define rep(i,n) for(int i=0;i<(n);i++) int N; struct Node{ int p,q; int val()const{return p*N+q;} Node operator+(Node r)const{return {p+r.p,q+r.q};} Node operator-(Node r)const{return {p-r.p,q-r.q};} bool operator<(Node r)const{return val()<r.val();} bool operator==(Node r)const{return val()==r.val();} }; Node f(Node l,Node r){ Node x={l.p-r.p,l.q-r.q}; if(x.p>x.q) swap(x.p,x.q); return x; } const int sign_offset=100; int main(){cin>>N; int NN=N*N-N; Node R[2500]; R[0]={0,0}; for(int i=2; i<=NN; i++){ cout<<"? "<<i<<" "<<1<<endl; cin>>R[i-1].p>>R[i-1].q; } int C[sign_offset*2]={}; rep(i,NN){ C[R[i].p+sign_offset]++; C[R[i].q+sign_offset]++; } Node ans1={-1,-1}; rep(i,sign_offset*2-1){ int prev = C[i]; if(prev+N <= C[i+1]){ ans1.p = -(i-sign_offset); prev+=N; } if(prev+N-1 <= C[i+1]){ ans1.q = -(i-sign_offset)-1; prev+=N-1; } } Node corner_val= {1,N-1}; if(ans1.q > N-1-ans1.q) corner_val={N-1,0}; int corner_p = -1; rep(i,NN) if(f(corner_val,ans1)==R[i]) corner_p=i; Node ans[2500]; rep(i,NN) ans[i]={-1,-1}; Node min_box = Node{1,0}-ans1; Node max_box = Node{N-1,N-1}-ans1; if(corner_val.q==0){ rep(i,NN){ if(ans[i].p!=-1) continue; if(R[i].p==R[i].q){ ans[i]=ans1+R[i]; continue; } if(R[i].p<min_box.p || R[i].q<min_box.q || R[i].p>max_box.p || R[i].q>max_box.q){ swap(R[i].p,R[i].q); ans[i]=R[i]+ans1; continue; } if(R[i].q<min_box.p || R[i].p<min_box.q || R[i].q>max_box.p || R[i].p>max_box.q){ ans[i]=R[i]+ans1; continue; } int rev=i+1; for(; rev<NN; rev++) if(make_pair(R[i].p,R[i].q)==make_pair(R[rev].p,R[rev].q)) break; cout<<"? "<<(i+1)<<" "<<(corner_p+1)<<endl; Node res; cin>>res.p>>res.q; ans[i]=res+corner_val; Node revres = ans[i]-ans1; swap(revres.p,revres.q); revres=revres+ans1; ans[rev]=revres; } } cout<<"!"; rep(i,NN) cout<<" "<<ans[i].val(); cout<<endl; return 0; }