| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1188067 | kl0989e | Worm Worries (BOI18_worm) | C++20 | 0 ms | 408 KiB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second
#define pb push_back
#define vi vector<int>
#define vl vector<ll>
#define pi pair<int, int>
#define pl pair<ll,ll>
#define all(x) (x).begin(),(x).end()
map<array<int,3>,int> mem;
int n, m, k, q;
int query(int x=1, int y=1, int z=1) {
if (mem.count({x,y,z})) {
return mem[{x,y,z}];
}
if (x<1 || n<x || y<1 || m<y || z<1 || k<z) {
return 0;
}
printf("? %d %d %d\n", x, y, z);
fflush(stdout);
int ans = -1;
(void)scanf("%d", &ans);
if (ans == -1) exit(0);
mem[{x,y,z}]=ans;
return ans;
}
__attribute__((noreturn))
void guess(int x=1, int y=1, int z=1) {
printf("! %d %d %d\n", x, y, z);
exit(0);
}
int main() {
(void)scanf("%d %d %d %d", &n, &m, &k, &q);
int l=1,r=n;
while (l<r) {
int m=l+(r-l)/2;
if (query(m)>=query(m+1)) {
r=m;
}
else {
l=m+1;
}
}
guess(l);
}Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
