結果
問題 | No.282 おもりと天秤(2) |
ユーザー | FF256grhy |
提出日時 | 2017-07-17 18:05:25 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 2,902 ms / 5,000 ms |
コード長 | 2,412 bytes |
コンパイル時間 | 1,547 ms |
コンパイル使用メモリ | 145,584 KB |
実行使用メモリ | 24,288 KB |
平均クエリ数 | 1023.00 |
最終ジャッジ日時 | 2023-09-24 01:24:41 |
合計ジャッジ時間 | 34,521 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 60 ms
23,376 KB |
testcase_01 | AC | 284 ms
23,688 KB |
testcase_02 | AC | 199 ms
23,700 KB |
testcase_03 | AC | 161 ms
23,556 KB |
testcase_04 | AC | 138 ms
24,048 KB |
testcase_05 | AC | 246 ms
23,616 KB |
testcase_06 | AC | 306 ms
23,988 KB |
testcase_07 | AC | 142 ms
23,400 KB |
testcase_08 | AC | 317 ms
23,424 KB |
testcase_09 | AC | 60 ms
23,352 KB |
testcase_10 | AC | 1,462 ms
23,400 KB |
testcase_11 | AC | 2,719 ms
23,976 KB |
testcase_12 | AC | 1,538 ms
24,288 KB |
testcase_13 | AC | 1,922 ms
24,060 KB |
testcase_14 | AC | 2,596 ms
24,216 KB |
testcase_15 | AC | 2,775 ms
23,688 KB |
testcase_16 | AC | 722 ms
23,376 KB |
testcase_17 | AC | 1,836 ms
23,664 KB |
testcase_18 | AC | 2,384 ms
23,976 KB |
testcase_19 | AC | 2,422 ms
23,424 KB |
testcase_20 | AC | 2,902 ms
23,376 KB |
testcase_21 | AC | 2,850 ms
23,364 KB |
testcase_22 | AC | 2,886 ms
23,388 KB |
testcase_23 | AC | 55 ms
23,364 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long signed int LL; typedef long long unsigned int LU; #define incID(i, l, r) for(int i = (l) ; i < (r); i++) #define incII(i, l, r) for(int i = (l) ; i <= (r); i++) #define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--) #define decII(i, l, r) for(int i = (r) ; i >= (l); i--) #define inc(i, n) incID(i, 0, n) #define inc1(i, n) incII(i, 1, n) #define dec(i, n) decID(i, 0, n) #define dec1(i, n) decII(i, 1, n) #define inII(v, l, r) ((l) <= (v) && (v) <= (r)) #define inID(v, l, r) ((l) <= (v) && (v) < (r)) #define PB push_back #define EB emplace_back #define MP make_pair #define FI first #define SE second #define UB upper_bound #define LB lower_bound #define PQ priority_queue #define ALL(v) v.begin(), v.end() #define RALL(v) v.rbegin(), v.rend() #define FOR(it, v) for(auto it = v.begin(); it != v.end(); ++it) #define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it) template<typename T> bool setmin(T & a, T b) { if(b < a) { a = b; return true; } else { return false; } } template<typename T> bool setmax(T & a, T b) { if(b > a) { a = b; return true; } else { return false; } } template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } } template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } } template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); } template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; } // ---- ---- int n, a[512], b[512]; int ll[512], rr[512]; string q[512]; void ask() { cout << "?"; inc(i, n) { cout << " " << a[ll[i]]; cout << " " << a[rr[i]]; } cout << endl; inc(i, 512) { q[i] = "="; } inc(i, n) { cin >> q[i]; } } void solve(int v) { int w = (1 << v); int c = 512 / w; inc(i, 512) { ll[i] = rr[i] = n + 1; } inc(i, c) { ll[i] = i * w; rr[i] = i * w + w / 2; } inc(k, w) { ask(); inc(i, c) { if(q[i] == "=") { continue; } b[i * w + k] = a[ (q[i] == ">" ? ll : rr)[i]++ ]; if(ll[i] == i * w + w / 2) { ll[i] = n + 1; } if(rr[i] == i * w + w ) { rr[i] = n + 1; } } } inc(i, 512) { a[i] = b[i]; } } void ans() { cout << "!"; dec(i, n) { cout << " " << a[i]; } cout << endl; } int main() { cin >> n; inc(i, n) { a[i] = i + 1; } inc1(i, 9) { solve(i); } ans(); return 0; }