結果
問題 | No.1306 Exactly 2 Digits |
ユーザー | 👑 Nachia |
提出日時 | 2020-12-03 23:13:16 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,028 bytes |
コンパイル時間 | 2,321 ms |
コンパイル使用メモリ | 204,464 KB |
実行使用メモリ | 25,824 KB |
平均クエリ数 | 1237.78 |
最終ジャッジ日時 | 2024-07-17 09:14:50 |
合計ジャッジ時間 | 18,510 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 26 ms
24,812 KB |
testcase_01 | AC | 24 ms
24,812 KB |
testcase_02 | AC | 24 ms
24,580 KB |
testcase_03 | AC | 24 ms
24,452 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | AC | 24 ms
25,220 KB |
testcase_07 | AC | 23 ms
24,580 KB |
testcase_08 | AC | 25 ms
25,220 KB |
testcase_09 | AC | 24 ms
25,220 KB |
testcase_10 | AC | 24 ms
25,220 KB |
testcase_11 | AC | 24 ms
24,836 KB |
testcase_12 | AC | 24 ms
24,836 KB |
testcase_13 | AC | 24 ms
24,812 KB |
testcase_14 | AC | 24 ms
24,812 KB |
testcase_15 | AC | 24 ms
24,556 KB |
testcase_16 | AC | 25 ms
24,812 KB |
testcase_17 | AC | 25 ms
24,812 KB |
testcase_18 | AC | 24 ms
24,940 KB |
testcase_19 | AC | 24 ms
24,556 KB |
testcase_20 | AC | 24 ms
24,808 KB |
testcase_21 | AC | 25 ms
25,196 KB |
testcase_22 | AC | 24 ms
25,196 KB |
testcase_23 | AC | 25 ms
25,196 KB |
testcase_24 | AC | 25 ms
25,196 KB |
testcase_25 | AC | 25 ms
25,824 KB |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | AC | 25 ms
25,068 KB |
testcase_29 | AC | 25 ms
24,928 KB |
testcase_30 | AC | 25 ms
25,196 KB |
testcase_31 | AC | 25 ms
24,812 KB |
testcase_32 | AC | 24 ms
24,556 KB |
testcase_33 | AC | 24 ms
24,812 KB |
testcase_34 | AC | 25 ms
25,052 KB |
testcase_35 | AC | 25 ms
24,812 KB |
testcase_36 | AC | 25 ms
24,940 KB |
testcase_37 | AC | 26 ms
25,436 KB |
testcase_38 | AC | 25 ms
24,812 KB |
testcase_39 | AC | 24 ms
24,556 KB |
testcase_40 | AC | 25 ms
25,196 KB |
testcase_41 | AC | 25 ms
24,812 KB |
testcase_42 | AC | 25 ms
24,940 KB |
testcase_43 | AC | 25 ms
24,812 KB |
testcase_44 | AC | 26 ms
25,196 KB |
testcase_45 | AC | 26 ms
24,428 KB |
testcase_46 | AC | 27 ms
24,940 KB |
testcase_47 | AC | 27 ms
24,940 KB |
testcase_48 | AC | 29 ms
25,196 KB |
testcase_49 | AC | 29 ms
24,796 KB |
testcase_50 | AC | 30 ms
24,812 KB |
testcase_51 | AC | 31 ms
25,196 KB |
testcase_52 | AC | 35 ms
24,556 KB |
testcase_53 | WA | - |
testcase_54 | AC | 33 ms
24,556 KB |
testcase_55 | AC | 37 ms
24,940 KB |
testcase_56 | AC | 39 ms
24,556 KB |
testcase_57 | AC | 40 ms
25,196 KB |
testcase_58 | AC | 41 ms
24,812 KB |
testcase_59 | AC | 42 ms
25,196 KB |
testcase_60 | AC | 49 ms
24,812 KB |
testcase_61 | AC | 53 ms
25,196 KB |
testcase_62 | AC | 53 ms
25,196 KB |
testcase_63 | AC | 56 ms
24,556 KB |
testcase_64 | WA | - |
testcase_65 | AC | 56 ms
25,192 KB |
testcase_66 | WA | - |
testcase_67 | WA | - |
testcase_68 | AC | 63 ms
24,812 KB |
testcase_69 | AC | 66 ms
24,812 KB |
testcase_70 | AC | 67 ms
25,196 KB |
testcase_71 | AC | 73 ms
24,556 KB |
testcase_72 | AC | 69 ms
25,196 KB |
testcase_73 | AC | 68 ms
24,940 KB |
testcase_74 | AC | 80 ms
24,812 KB |
testcase_75 | AC | 76 ms
25,196 KB |
testcase_76 | AC | 87 ms
25,068 KB |
testcase_77 | AC | 95 ms
25,196 KB |
testcase_78 | WA | - |
testcase_79 | AC | 107 ms
24,940 KB |
testcase_80 | AC | 113 ms
24,812 KB |
testcase_81 | AC | 93 ms
24,812 KB |
testcase_82 | AC | 119 ms
24,928 KB |
testcase_83 | AC | 118 ms
24,556 KB |
testcase_84 | AC | 127 ms
25,196 KB |
testcase_85 | AC | 134 ms
25,196 KB |
testcase_86 | AC | 111 ms
25,452 KB |
testcase_87 | AC | 116 ms
24,812 KB |
testcase_88 | AC | 146 ms
25,196 KB |
testcase_89 | AC | 118 ms
24,556 KB |
testcase_90 | AC | 103 ms
24,940 KB |
testcase_91 | WA | - |
testcase_92 | AC | 103 ms
25,196 KB |
testcase_93 | AC | 125 ms
25,196 KB |
testcase_94 | AC | 103 ms
25,196 KB |
testcase_95 | AC | 110 ms
25,068 KB |
testcase_96 | AC | 101 ms
25,196 KB |
testcase_97 | AC | 99 ms
25,196 KB |
testcase_98 | AC | 96 ms
24,940 KB |
testcase_99 | AC | 115 ms
24,544 KB |
testcase_100 | AC | 116 ms
24,556 KB |
testcase_101 | AC | 125 ms
24,800 KB |
testcase_102 | AC | 102 ms
25,196 KB |
testcase_103 | AC | 110 ms
24,940 KB |
testcase_104 | AC | 109 ms
24,812 KB |
testcase_105 | AC | 111 ms
24,812 KB |
testcase_106 | AC | 98 ms
24,800 KB |
testcase_107 | AC | 111 ms
25,040 KB |
testcase_108 | AC | 103 ms
24,940 KB |
testcase_109 | WA | - |
testcase_110 | AC | 102 ms
24,812 KB |
testcase_111 | AC | 109 ms
24,556 KB |
testcase_112 | AC | 96 ms
24,796 KB |
testcase_113 | AC | 133 ms
24,812 KB |
testcase_114 | WA | - |
testcase_115 | AC | 111 ms
24,556 KB |
testcase_116 | AC | 143 ms
25,068 KB |
testcase_117 | AC | 117 ms
25,196 KB |
testcase_118 | WA | - |
testcase_119 | AC | 106 ms
24,556 KB |
testcase_120 | AC | 99 ms
25,196 KB |
testcase_121 | AC | 121 ms
24,556 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 p==r.p && q==r.q;} Node swap()const{return {q,p};} }; 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; } Node query(int i,int j){ cout<<"? "<<i<<" "<<j<<endl; Node q; cin>>q.p>>q.q; return q;} const int sign_offset=100; int main(){ cin>>N; int NN=N*N-N; Node R[2500]; rep(i,NN) R[i] = query(i+1,1); 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){ if(C[i]+N <= C[i+1]){ ans1.p = -(i-sign_offset)-1; for(int j=i+1; j<=i+N-1; j++) C[j]-=N; } if(C[i]+N-1 <= C[i+1]){ ans1.q = -(i-sign_offset)-1; for(int j=i+1; j<=i+N; j++) C[j]-=(N-1); } } Node corner_val= {0,N-1}; if(ans1.q > N-1-ans1.q) corner_val={N-2,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{0,0}-ans1; Node max_box = Node{N-2,N-1}-ans1; rep(i,NN){ if(ans[i].p!=-1) continue; Node buf = R[i]; if(buf.p==buf.q){ ans[i]=ans1+buf; continue; } if(buf.p<min_box.p || buf.q<min_box.q || buf.p>max_box.p || buf.q>max_box.q){ ans[i]=buf.swap()+ans1; continue; } if(buf.q<min_box.p || buf.p<min_box.q || buf.q>max_box.p || buf.p>max_box.q){ ans[i]=buf+ans1; continue; } int rev=-1; for(int j=i+1; j<NN; j++) if(R[i]==R[j]) rev=j; Node res=query(i+1,corner_p+1); if(corner_val.q!=0) res=res.swap(); ans[i]=res+corner_val; Node revres = (ans[i]-ans1).swap()+ans1; ans[rev]=revres; } cout<<"!"; rep(i,NN) cout<<" "<<(ans[i].val()+N); cout<<endl; return 0; }