結果
問題 |
No.3018 目隠し宝探し
|
ユーザー |
![]() |
提出日時 | 2025-01-25 13:25:27 |
言語 | C (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 961 bytes |
コンパイル時間 | 291 ms |
コンパイル使用メモリ | 25,728 KB |
実行使用メモリ | 87,352 KB |
平均クエリ数 | 2.23 |
最終ジャッジ日時 | 2025-01-25 22:46:31 |
合計ジャッジ時間 | 18,181 ms |
ジャッジサーバーID (参考情報) |
judge8 / judge9 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | WA * 15 RE * 1 TLE * 5 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:4:14: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 4 | int H,W; scanf("%d %d",&H,&W); | ^~~~~~~~~~~~~~~~~~~~ main.c:6:13: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | int d1; scanf("%d",&d1); | ^~~~~~~~~~~~~~~ main.c:9:13: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | int d2; scanf("%d",&d2); | ^~~~~~~~~~~~~~~ main.c:29:13: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 29 | int d3; scanf("%d",&d3); | ^~~~~~~~~~~~~~~
ソースコード
#include<stdio.h> int main(){ int H,W; scanf("%d %d",&H,&W); printf("? %d %d\n",1,1); fflush(stdout); int d1; scanf("%d",&d1); if(d1==-1)return 1; printf("? %d %d\n",H,W); fflush(stdout); int d2; scanf("%d",&d2); if(d2==-1)while(1); int D[2][2]={{-1,-1},{-1,-1}}; int size=0; for(int i=1;i<=H;i++){ for(int j=1;j<=W;j++){ int dist1=(i-1)*(i-1)+(j-1)*(j-1); int dist2=(i-H)*(i-H)+(j-W)*(j-W); if(dist1==d1 && dist2==d2){ if(size>=2)return 1; D[size][0]=i; D[size][1]=j; size++; } } } printf("? %d %d\n",D[0][0],D[0][1]); fflush(stdout); int d3; scanf("%d",&d3); if(d3==-1)return 0; if(d3==0)printf("! %d %d\n",D[0][0],D[0][1]),fflush(stdout); else{ if(size==1)return 1; printf("! %d %d\n",D[1][0],D[1][1]),fflush(stdout); } return 0; }