結果
問題 | No.1306 Exactly 2 Digits |
ユーザー | tokusakurai |
提出日時 | 2020-12-03 16:47:41 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,120 bytes |
コンパイル時間 | 2,790 ms |
コンパイル使用メモリ | 222,792 KB |
実行使用メモリ | 25,580 KB |
平均クエリ数 | 1237.78 |
最終ジャッジ日時 | 2024-07-17 08:47:40 |
合計ジャッジ時間 | 16,995 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 24 ms
24,556 KB |
testcase_01 | AC | 23 ms
24,812 KB |
testcase_02 | AC | 23 ms
24,836 KB |
testcase_03 | AC | 23 ms
25,220 KB |
testcase_04 | AC | 23 ms
24,836 KB |
testcase_05 | AC | 23 ms
25,220 KB |
testcase_06 | AC | 23 ms
24,836 KB |
testcase_07 | AC | 22 ms
24,964 KB |
testcase_08 | AC | 23 ms
24,964 KB |
testcase_09 | AC | 22 ms
24,580 KB |
testcase_10 | AC | 23 ms
24,964 KB |
testcase_11 | WA | - |
testcase_12 | AC | 22 ms
24,964 KB |
testcase_13 | AC | 22 ms
24,812 KB |
testcase_14 | WA | - |
testcase_15 | AC | 22 ms
25,196 KB |
testcase_16 | AC | 23 ms
24,812 KB |
testcase_17 | AC | 22 ms
24,556 KB |
testcase_18 | AC | 23 ms
24,556 KB |
testcase_19 | AC | 23 ms
25,196 KB |
testcase_20 | AC | 23 ms
24,812 KB |
testcase_21 | AC | 23 ms
24,556 KB |
testcase_22 | AC | 24 ms
24,940 KB |
testcase_23 | AC | 23 ms
24,812 KB |
testcase_24 | AC | 23 ms
24,940 KB |
testcase_25 | AC | 24 ms
25,196 KB |
testcase_26 | AC | 24 ms
25,184 KB |
testcase_27 | AC | 23 ms
25,196 KB |
testcase_28 | AC | 23 ms
24,812 KB |
testcase_29 | AC | 23 ms
24,940 KB |
testcase_30 | AC | 23 ms
25,196 KB |
testcase_31 | AC | 24 ms
24,812 KB |
testcase_32 | WA | - |
testcase_33 | AC | 24 ms
24,556 KB |
testcase_34 | AC | 26 ms
24,928 KB |
testcase_35 | AC | 26 ms
25,196 KB |
testcase_36 | AC | 24 ms
24,940 KB |
testcase_37 | AC | 24 ms
25,196 KB |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | AC | 24 ms
24,812 KB |
testcase_41 | AC | 25 ms
24,556 KB |
testcase_42 | AC | 24 ms
24,556 KB |
testcase_43 | AC | 26 ms
24,556 KB |
testcase_44 | AC | 26 ms
24,556 KB |
testcase_45 | AC | 27 ms
24,812 KB |
testcase_46 | AC | 26 ms
24,928 KB |
testcase_47 | AC | 28 ms
25,196 KB |
testcase_48 | AC | 29 ms
25,196 KB |
testcase_49 | AC | 30 ms
24,556 KB |
testcase_50 | AC | 29 ms
24,812 KB |
testcase_51 | AC | 31 ms
24,556 KB |
testcase_52 | AC | 33 ms
24,940 KB |
testcase_53 | AC | 36 ms
25,280 KB |
testcase_54 | AC | 34 ms
24,940 KB |
testcase_55 | AC | 37 ms
24,812 KB |
testcase_56 | AC | 39 ms
24,940 KB |
testcase_57 | AC | 41 ms
25,196 KB |
testcase_58 | AC | 43 ms
24,940 KB |
testcase_59 | AC | 41 ms
25,452 KB |
testcase_60 | AC | 50 ms
24,812 KB |
testcase_61 | AC | 53 ms
24,812 KB |
testcase_62 | AC | 52 ms
24,556 KB |
testcase_63 | AC | 55 ms
24,940 KB |
testcase_64 | AC | 54 ms
24,556 KB |
testcase_65 | AC | 56 ms
24,556 KB |
testcase_66 | AC | 61 ms
24,812 KB |
testcase_67 | AC | 64 ms
24,556 KB |
testcase_68 | AC | 62 ms
24,812 KB |
testcase_69 | AC | 67 ms
24,940 KB |
testcase_70 | AC | 67 ms
24,812 KB |
testcase_71 | AC | 71 ms
24,812 KB |
testcase_72 | AC | 71 ms
24,668 KB |
testcase_73 | AC | 69 ms
25,196 KB |
testcase_74 | AC | 81 ms
24,812 KB |
testcase_75 | AC | 78 ms
24,940 KB |
testcase_76 | AC | 87 ms
25,324 KB |
testcase_77 | AC | 93 ms
24,556 KB |
testcase_78 | AC | 99 ms
24,812 KB |
testcase_79 | AC | 106 ms
24,940 KB |
testcase_80 | AC | 109 ms
24,812 KB |
testcase_81 | AC | 92 ms
25,196 KB |
testcase_82 | AC | 115 ms
25,040 KB |
testcase_83 | AC | 117 ms
25,196 KB |
testcase_84 | AC | 124 ms
25,196 KB |
testcase_85 | AC | 131 ms
24,940 KB |
testcase_86 | AC | 108 ms
24,812 KB |
testcase_87 | AC | 115 ms
24,940 KB |
testcase_88 | AC | 139 ms
25,196 KB |
testcase_89 | AC | 116 ms
24,812 KB |
testcase_90 | AC | 103 ms
24,812 KB |
testcase_91 | AC | 112 ms
24,812 KB |
testcase_92 | AC | 105 ms
24,556 KB |
testcase_93 | AC | 119 ms
24,940 KB |
testcase_94 | AC | 105 ms
24,940 KB |
testcase_95 | AC | 111 ms
24,556 KB |
testcase_96 | AC | 102 ms
25,196 KB |
testcase_97 | AC | 102 ms
25,196 KB |
testcase_98 | AC | 98 ms
24,556 KB |
testcase_99 | AC | 114 ms
25,196 KB |
testcase_100 | AC | 114 ms
25,580 KB |
testcase_101 | AC | 122 ms
24,812 KB |
testcase_102 | AC | 103 ms
25,040 KB |
testcase_103 | AC | 109 ms
24,556 KB |
testcase_104 | AC | 109 ms
24,940 KB |
testcase_105 | AC | 112 ms
25,196 KB |
testcase_106 | AC | 99 ms
24,940 KB |
testcase_107 | AC | 113 ms
25,196 KB |
testcase_108 | AC | 105 ms
24,940 KB |
testcase_109 | AC | 126 ms
25,196 KB |
testcase_110 | AC | 102 ms
24,556 KB |
testcase_111 | AC | 107 ms
24,812 KB |
testcase_112 | AC | 96 ms
24,940 KB |
testcase_113 | AC | 130 ms
24,812 KB |
testcase_114 | AC | 131 ms
24,556 KB |
testcase_115 | AC | 110 ms
25,452 KB |
testcase_116 | AC | 135 ms
24,812 KB |
testcase_117 | AC | 119 ms
24,556 KB |
testcase_118 | AC | 125 ms
25,196 KB |
testcase_119 | AC | 107 ms
24,812 KB |
testcase_120 | AC | 100 ms
24,556 KB |
testcase_121 | AC | 119 ms
24,556 KB |
testcase_122 | AC | 118 ms
24,940 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for(int i = 0; i < n; i++) #define rep2(i, x, n) for(int i = x; i <= n; i++) #define rep3(i, x, n) for(int i = x; i >= n; i--) #define each(e, v) for(auto &e: v) #define pb push_back #define eb emplace_back #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define sz(x) (int)x.size() using ll = long long; using pii = pair<int, int>; using pil = pair<int, ll>; using pli = pair<ll, int>; using pll = pair<ll, ll>; const int MOD = 1000000007; //const int MOD = 998244353; const int inf = (1<<30)-1; const ll INF = (1LL<<60)-1; template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;}; template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;}; struct io_setup{ io_setup(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout << fixed << setprecision(15); } } io_setup; int N; pii query(int i, int j){ cout << "? " << j+1 << ' ' << i+1 << endl; int x, y; cin >> x >> y; return pii(x, y); } void answer(vector<pii> ans){ cout << '!'; each(e, ans) cout << ' ' << N*(e.second+1)+e.first; cout << endl; } int main(){ cin >> N; map<pii, vector<int>> mp; rep(i, N*(N-1)){ mp[query(0, i)].eb(i); } vector<pii> ans(N*(N-1), pii(-1, -1)); int l = 0; while(mp.count(pii(l, l))) --l; int r = 0; while(mp.count(pii(r, r))) ++r; int k = r-l-1; pii c1 = pii(0, N-1-k), c2 = pii(N-k, 0); c1.first -= l+1, c1.second -= l+1, c2.first -= l+1, c2.second -= l+1; map<pii, int> cmp; rep(i, N) rep(j, N-1){ int x = i-c1.first, y = j-c1.second; cmp[minmax(x, y)]++; } bool flag = true; each(e, mp){ if(sz(e.second) != cmp[e.first]) flag = false; } if(!flag) swap(c1, c2); auto [cx, cy] = c1; each(e, mp){ if(sz(e.second) == 1){ auto [dx, dy] = e.first; if(0 <= cx+dx && cx+dx < N && 0 <= cy+dy && cy+dy < N-1) ans[e.second[0]] = pii(cx+dx, cy+dy); else ans[e.second[0]] = pii(cx+dy, cy+dx); } } int id1 = 0, id2 = 0; rep(i, N*(N-1)){ if(ans[i].first == 0 && ans[i].second == 0) id1 = i; if(ans[i].first == N-1 && ans[i].second == N-2) id2 = i; } each(e, mp){ if(sz(e.second) == 2){ auto [dx, dy] = e.first; int p = e.second[0], q = e.second[1]; if(cx != cy){ auto [x, y] = query(id1, p); if((x == cx+dx && y == cy+dy) || (y == cx+dx && x == cy+dy)) ans[p] = pii(cx+dx, cy+dy), ans[q] = pii(cx+dy, cy+dx); else ans[q] = pii(cx+dx, cy+dy), ans[p] = pii(cx+dy, cy+dx); } else{ auto [x, y] = query(id2, p); if((N-1-x == cx+dx && N-2-y == cy+dy) || (N-1-y == cx+dx && N-2-x == cy+dy)) ans[p] = pii(cx+dx, cy+dy), ans[q] = pii(cx+dy, cy+dx); else ans[q] = pii(cx+dx, cy+dy), ans[p] = pii(cx+dy, cy+dx); } } } answer(ans); }