| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1188184 | dzuizz | Worm Worries (BOI18_worm) | C++20 | 3079 ms | 4312 KiB |
#include <bits/stdc++.h>
int qry(int x, int y, int z) {
printf("? %d %d %d\n", x, y, z);
fflush(stdout);
int ans = -1;
(void)scanf("%d", &ans);
if (ans == -1) exit(0);
return ans;
}
__attribute__((noreturn))
void ans(int x, int y, int z) {
printf("! %d %d %d\n", x, y, z);
exit(0);
}
int main() {
int N, M, K, Q;
(void)scanf("%d %d %d %d", &N, &M, &K, &Q);
// TODO do something smart
int g[N+2]; memset(g,-1,sizeof g);
g[0]=g[N+1]=0;
int l=1,r=N;
while(l+1<r){
int s=(r-l+1)/3;
int lm=l+s,rm=r-s;
if(lm==rm) --lm;
if(g[lm]==-1) g[lm]=qry(lm,1,1);
if(g[rm]==-1) g[rm]=qry(rm,1,1);
if(g[lm]>g[rm]) r=rm;
else l=lm;
}
if(g[l]==-1) g[l]=qry(l,1,1);
if(g[r]==-1) g[r]=qry(r,1,1);
int res=(g[l]>g[r]?l:r);
ans(res,1,1);
return 0;
}
컴파일 시 표준 에러 (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... | ||||
