제출 #985833

#제출 시각아이디문제언어결과실행 시간메모리
985833ByeWorldWorm Worries (BOI18_worm)C++14
0 / 100
3080 ms344 KiB
#include <bits/stdc++.h> #define ll long long #define pb push_back #define fi first #define se second #define lf (id<<1) #define rg ((id<<1)|1) #define md ((l+r)>>1) #define ld long double using namespace std; typedef pair<int,int> pii; typedef pair<pii,int> ipii; vector <int> vx = {1, -1, 0, 0, 0, 0}; vector <int> vy = {0, 0, 1, -1, 0, 0}; vector <int> vz = {0, 0, 0, 0, 1, -1}; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int all, n, m, k, q; int ansx, ansy, ansz; int que(int a, int b, int c){ if(a<=0 || a>=n || b<=0 || b>=m || c<=0 || c>=k) return -1; cout << "? " << a << ' ' << b << ' ' << c << endl; all++; int x; cin >> x; return x; } int num(int r){ int x = rng(); x %= r; x++; return x; } signed main(){ cin >> n >> m >> k >> q; while(all < q){ int tot = 0; int a = num(n), b = num(m), c = num(k); int sta = que(a, b, c); while(tot < 20){ int mx = -1, idx = -1, done = 0; for(int i=0; i<6; i++){ if(all == q) break; int ret = que(a+vx[i], b+vy[i], c+vz[i]); if(i==5) done = 1; if(ret == -1) continue; if(mx <= ret){ mx = ret; idx = i; } } if(mx==-1 && done){ ansx = a; ansy = b; ansz = c; break; } else { a += vx[idx]; b += vy[idx]; c += vz[idx]; tot++; } } } cout << "! " << ansx << ' ' << ansy << ' '<< ansz << endl; }

컴파일 시 표준 에러 (stderr) 메시지

worm.cpp: In function 'int main()':
worm.cpp:38:7: warning: unused variable 'sta' [-Wunused-variable]
   38 |   int sta = que(a, b, c);
      |       ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...