結果
問題 | No.1306 Exactly 2 Digits |
ユーザー | trineutron |
提出日時 | 2020-12-03 02:01:08 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 2,481 bytes |
コンパイル時間 | 2,646 ms |
コンパイル使用メモリ | 220,608 KB |
実行使用メモリ | 25,776 KB |
平均クエリ数 | 1043.46 |
最終ジャッジ日時 | 2024-07-17 08:11:27 |
合計ジャッジ時間 | 41,370 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 27 ms
24,556 KB |
testcase_01 | AC | 24 ms
24,556 KB |
testcase_02 | AC | 23 ms
24,580 KB |
testcase_03 | AC | 24 ms
24,964 KB |
testcase_04 | RE | - |
testcase_05 | RE | - |
testcase_06 | AC | 23 ms
24,580 KB |
testcase_07 | AC | 24 ms
24,836 KB |
testcase_08 | AC | 25 ms
24,836 KB |
testcase_09 | AC | 25 ms
24,580 KB |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | AC | 27 ms
24,580 KB |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | AC | 23 ms
24,940 KB |
testcase_16 | RE | - |
testcase_17 | RE | - |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | AC | 23 ms
24,556 KB |
testcase_21 | AC | 25 ms
24,812 KB |
testcase_22 | AC | 24 ms
24,940 KB |
testcase_23 | RE | - |
testcase_24 | AC | 25 ms
25,184 KB |
testcase_25 | RE | - |
testcase_26 | RE | - |
testcase_27 | RE | - |
testcase_28 | AC | 25 ms
24,812 KB |
testcase_29 | AC | 26 ms
24,940 KB |
testcase_30 | RE | - |
testcase_31 | RE | - |
testcase_32 | RE | - |
testcase_33 | RE | - |
testcase_34 | RE | - |
testcase_35 | AC | 25 ms
24,940 KB |
testcase_36 | RE | - |
testcase_37 | RE | - |
testcase_38 | RE | - |
testcase_39 | RE | - |
testcase_40 | RE | - |
testcase_41 | RE | - |
testcase_42 | RE | - |
testcase_43 | RE | - |
testcase_44 | RE | - |
testcase_45 | RE | - |
testcase_46 | RE | - |
testcase_47 | RE | - |
testcase_48 | RE | - |
testcase_49 | RE | - |
testcase_50 | RE | - |
testcase_51 | RE | - |
testcase_52 | RE | - |
testcase_53 | RE | - |
testcase_54 | RE | - |
testcase_55 | RE | - |
testcase_56 | RE | - |
testcase_57 | RE | - |
testcase_58 | RE | - |
testcase_59 | RE | - |
testcase_60 | RE | - |
testcase_61 | RE | - |
testcase_62 | RE | - |
testcase_63 | RE | - |
testcase_64 | RE | - |
testcase_65 | RE | - |
testcase_66 | RE | - |
testcase_67 | RE | - |
testcase_68 | RE | - |
testcase_69 | RE | - |
testcase_70 | RE | - |
testcase_71 | RE | - |
testcase_72 | RE | - |
testcase_73 | RE | - |
testcase_74 | RE | - |
testcase_75 | RE | - |
testcase_76 | RE | - |
testcase_77 | RE | - |
testcase_78 | RE | - |
testcase_79 | RE | - |
testcase_80 | RE | - |
testcase_81 | RE | - |
testcase_82 | RE | - |
testcase_83 | RE | - |
testcase_84 | RE | - |
testcase_85 | RE | - |
testcase_86 | RE | - |
testcase_87 | RE | - |
testcase_88 | RE | - |
testcase_89 | RE | - |
testcase_90 | RE | - |
testcase_91 | RE | - |
testcase_92 | RE | - |
testcase_93 | RE | - |
testcase_94 | RE | - |
testcase_95 | RE | - |
testcase_96 | RE | - |
testcase_97 | RE | - |
testcase_98 | RE | - |
testcase_99 | RE | - |
testcase_100 | RE | - |
testcase_101 | RE | - |
testcase_102 | RE | - |
testcase_103 | RE | - |
testcase_104 | RE | - |
testcase_105 | RE | - |
testcase_106 | RE | - |
testcase_107 | RE | - |
testcase_108 | RE | - |
testcase_109 | RE | - |
testcase_110 | RE | - |
testcase_111 | RE | - |
testcase_112 | RE | - |
testcase_113 | RE | - |
testcase_114 | RE | - |
testcase_115 | RE | - |
testcase_116 | RE | - |
testcase_117 | RE | - |
testcase_118 | RE | - |
testcase_119 | RE | - |
testcase_120 | RE | - |
testcase_121 | RE | - |
testcase_122 | RE | - |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int m = n * (n - 1); vector<int> dx(m), dy(m); for (int i = 1; i < m; i++) { cout << "? " << i + 1 << " " << 1 << endl; cin >> dx.at(i) >> dy.at(i); } int dxmax = *max_element(dx.begin(), dx.end()), dymax = *max_element(dy.begin(), dy.end()), dxmin = *min_element(dx.begin(), dx.end()), dymin = *min_element(dy.begin(), dy.end()); if (dxmax - dxmin < n - 1) { swap(dxmax, dymax); swap(dxmin, dymin); for (int i = 0; i < m; i++) { swap(dx.at(i), dy.at(i)); } } assert(dxmax - dxmin == n - 1); assert(dymax - dymin == n - 2); map<pair<int, int>, bool> twoway; vector index(n, vector(n - 1, -1)); for (int i = 0; i < m; i++) { if (index.at(dx.at(i) - dxmin).at(dy.at(i) - dymin) != -1) { twoway[{dx.at(i), dy.at(i)}] = true; swap(dx.at(i), dy.at(i)); twoway[{dx.at(i), dy.at(i)}] = true; } index.at(dx.at(i) - dxmin).at(dy.at(i) - dymin) = i; } int base = -1; for (int i = 0; i < m; i++) { if (dxmin != dymin and dx.at(i) == dxmin and dy.at(i) == dymin) { base = i; break; } if (dxmin == dymin and dx.at(i) == dxmax and dy.at(i) == dymax) { base = i; break; } } vector<bool> visited(m); for (int i = 0; i < m; i++) { assert(i == index.at(dx.at(i) - dxmin).at(dy.at(i) - dymin)); if (visited.at(i)) continue; if (not twoway[{dx.at(i), dy.at(i)}]) continue; int co_i = index.at(dy.at(i) - dxmin).at(dx.at(i) - dymin); cout << "? " << i + 1 << " " << base + 1 << endl; int dxbase, dybase; cin >> dxbase >> dybase; if (dx.at(i) != dxbase + dx.at(base)) { swap(dx.at(i), dy.at(i)); } if (dx.at(i) != dxbase + dx.at(base)) { swap(dxbase, dybase); } if (dx.at(i) != dxbase + dx.at(base)) { swap(dx.at(i), dy.at(i)); } assert(dx.at(i) == dxbase + dx.at(base)); assert(dy.at(i) == dybase + dy.at(base)); dx.at(co_i) = dy.at(i); dy.at(co_i) = dx.at(i); visited.at(co_i) = true; } cout << "!"; for (int i = 0; i < m; i++) { cout << " " << n * (dy.at(i) - dymin) + (dx.at(i) - dxmin) + n; } cout << endl; }