結果
問題 | No.624 Santa Claus and The Last Dungeon |
ユーザー | FF256grhy |
提出日時 | 2017-12-24 04:38:21 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 4,314 bytes |
コンパイル時間 | 1,905 ms |
コンパイル使用メモリ | 178,476 KB |
実行使用メモリ | 25,464 KB |
平均クエリ数 | 457.03 |
最終ジャッジ日時 | 2024-07-16 15:09:30 |
合計ジャッジ時間 | 12,517 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
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 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
ソースコード
#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 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; } // ---- ---- const int M = 100; int q, a[M]; int ask() { inc(i, M) { if(i != 0) { cout << " "; } if(a[i] != -1) { printf("%02d", a[i]); } else { cout << "??"; } } cout << endl; int x, y, z; cin >> x >> y >> z; //cin >> z; return z; } int g(int l, int r, int vl, int vr) { int b[M]; inc(i, M) { b[i] = a[i]; } int m = (l + r) / 2; inc(i, M) { a[i] = (inID(i, l, r) ? (i < m ? vl : vr) : -1); } int val = ask(); inc(i, M) { a[i] = b[i]; } return val; } void pr() { cout << "a: "; inc(i, M) { cout << a[i] << " "; } cout << endl; } int h[M]; vector<array<int, 3>> bi; void f(int l, int r, vector<int> & v) { int n = v.size(); assert(r - l == n); if(n == 0) { return; } if(n == 1) { a[l] = v[0]; return; } if(n == 2) { bi.PB({ l, v[0], v[1] }); return; } int gg; if(n % 2 == 1) { gg = g(l, r, v[0], -1); h[v[0]] = (gg == 1 ? 0 : 1); } incID(i, n % 2, n) { gg = g(l, r, v[i], v[i + 1]); if(gg == 2) { h[v[i]] = 0; h[v[i + 1]] = 1; } if(gg == 0) { h[v[i]] = 1; h[v[i + 1]] = 0; } if(gg == 1) { gg = g(l, r, v[i], -1); h[v[i]] = h[v[i + 1]] = (gg == 1 ? 0 : 1); } i++; } vector<int> w[2]; inc(i, n) { w[h[v[i]]].PB(v[i]); } int m = (l + r) / 2; f(l, m, w[0]); f(m, r, w[1]); } void setb(int bp, vector<int> v) { inc(i, v.size()) { a[bi[bp + i][0] + 0] = bi[i][1 + v[i]]; a[bi[bp + i][0] + 1] = bi[i][2 - v[i]]; } } int askb(int bp, vector<int> v) { int b[M]; setb(bp, v); inc(i, M) { b[i] = a[i]; } inc(i, M) { a[i] = -1; } setb(bp, v); int val = ask(); inc(i, M) { a[i] = b[i]; } return val / 2; } void bb() { int n = bi.size(); inc(i, n) { a[bi[i][0]] = a[bi[i][0] + 1] = -1; } inc(i, n % 4) { if(askb(i, { 0 }) == 0) { setb(i, { 1 }); } } incID(i, n % 4, n) { int gg = askb(i, { 0, 0, 0, 0 }); if(gg == 4) { } if(gg == 0) { setb(i, { 1, 1, 1, 1 }); } if(gg == 3) { int hh = askb(i, { 1, 1, 0, 0 }); if(hh == 3) { if(askb(i, { 1, 0, 0, 0 }) == 2) { setb(i, { 0, 1, 0, 0 }); } } if(hh == 1) { if(askb(i, { 0, 0, 1, 0 }) == 2) { setb(i, { 0, 0, 0, 1 }); } } } if(gg == 1) { int hh = askb(i, { 0, 0, 1, 1 }); if(hh == 3) { if(askb(i, { 0, 1, 1, 1 }) == 2) { setb(i, { 1, 0, 1, 1 }); } } if(hh == 1) { if(askb(i, { 1, 1, 0, 1 }) == 2) { setb(i, { 1, 1, 1, 0 }); } } } if(gg == 2) { int hh = askb(i, { 1, 1, 0, 0 }); if(hh == 4) { } if(hh == 0) { setb(i, { 0, 0, 1, 1 }); } if(hh == 2) { int ii = askb(i, { 0, 1, 0, 1 }); if(ii == 4) { } if(ii == 0) { setb(i, { 1, 0, 1, 0 }); } if(ii == 2) { if(askb(i, { 0, 1, 1, 0 }) == 0) { setb(i, { 1, 0, 0, 1 }); } } } } i += 3; } } int main() { cin >> q; vector<int> v; inc(i, M) { v.PB(i); } f(0, M, v); bb(); ask(); return 0; }