Submission #1129493

#TimeUsernameProblemLanguageResultExecution timeMemory
1129493AgageldiWorm Worries (BOI18_worm)C++20
0 / 100
855 ms984748 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define N 400005 #define ff first #define ss second #define pb push_back #define sz(s) (int)s.size() ll n, p, k, answer, q, x1, x2, x3, ans, w; int b[] = {1,-1,0,0,0,0,0}; int c[] = {0,0,1,-1,0,0,0}; int d[] = {0,0,0,0,1,-1,0}; int main () { cin >> n >> p >> k >> q; x1 = (n + 1)/2; x2 = (p + 1)/2; x3 = (k + 1)/2; ll a[n+1][p+1][k+1]; memset(a,0,sizeof a); while(1) { for(int i = 0; i < 7; i++) { if(x1 + b[i] < 1 || x2 + c[i] < 1 || x3 + d[i] < 1) continue; if(x1 + b[i] > n || x2 + c[i] > p || x3 + d[i] > k) continue; if(!a[x1+b[i]][x2+c[i]][x3+d[i]]) { cout << "? "<< x1 + b[i] << " " << x2 + c[i] << " " << x3 + d[i]; fflush(stdout); cin >> a[x1 + b[i]][x2 + c[i]][x3 + d[i]]; } } ans = w = 0; for(int i = 0; i < 7; i++) { if(x1 + b[i] < 1 || x2 + c[i] < 1 || x3 + d[i] < 1) continue; if(x1 + b[i] > n || x2 + c[i] > p || x3 + d[i] > k) continue; if(ans <= a[x1 + b[i]][x2 + c[i]][x3 + d[i]]) w = i; ans = max(ans,a[x1 + b[i]][x2 + c[i]][x3 + d[i]]); } if(w == 6) { cout << "! " << x1 <<" " << x2 << " " << x3; fflush(stdout); return 0; } x1 += b[w]; x2 += c[w]; x3 += d[w]; } }
#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...