Submission #645307

#TimeUsernameProblemLanguageResultExecution timeMemory
645307mychecksedadWorm Worries (BOI18_worm)C++17
0 / 100
1 ms208 KiB
/* Author : Mychecksdead */ #include<bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; #define MOD (1000000000+7) #define MOD1 (998244353) #define PI 3.1415926535 #define pb push_back #define setp() cout << setprecision(15) #define all(x) x.begin(), x.end() #define debug(x) cerr << #x << " is " << x << '\n'; const int N = 1e6+100, M = 1e5+10, F = 2147483646, K = 20; int n, m, k, q; int query(int x, int y, int z){ if(x == 0 || x == n + 1) return 0; cout << "? " << x << ' ' << y << ' ' << z << endl; int a; cin >> a; return a; } void solve(){ cin >> n >> m >> k >> q; int l = 1, r = n; while(l <= r){ int m = (l + r) >> 1; int q = query(m - 1, 1, 1); int q1 = query(m, 1, 1); int q2 = query(m + 1, 1, 1); if(q <= q1 && q1 >= q2){ cout << "! " << m << " 1 1" << endl; return; } if(q <= q1 && q1 <= q2){ r = m - 1; }else if(q2 >= q1 && q1 >= q){ l = m + 1; }else{ r = m - 1; } } } int main(){ cin.tie(0); ios::sync_with_stdio(0); int T = 1, aa; // cin >> T;aa=T; while(T--){ // cout << "Case #" << aa-T << ": "; solve(); cout << '\n'; } return 0; }

Compilation message (stderr)

worm.cpp: In function 'int main()':
worm.cpp:53:16: warning: unused variable 'aa' [-Wunused-variable]
   53 |     int T = 1, aa;
      |                ^~
#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...