結果
| 問題 |
No.1149 色塗りゲーム
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-08-07 21:42:39 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 468 bytes |
| コンパイル時間 | 2,084 ms |
| コンパイル使用メモリ | 192,928 KB |
| 最終ジャッジ日時 | 2025-01-12 16:22:55 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 5 RE * 45 |
コンパイルメッセージ
main.cpp: In function ‘std::pair<int, int> ask(int, int)’:
main.cpp:10:21: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
10 | int t; scanf("%d",&t);
| ~~~~~^~~~~~~~~
main.cpp:13:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
13 | scanf("%d%d",&k,&x);
| ~~~~~^~~~~~~~~~~~~~
main.cpp: In function ‘int main()’:
main.cpp:19:21: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
19 | int n; scanf("%d",&n);
| ~~~~~^~~~~~~~~
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
pair<int,int> ask(int k,int x){
printf("%d %d\n",k,x);
fflush(stdout);
int t; scanf("%d",&t);
if(t==1) exit(1);
if(t==0) exit(0);
scanf("%d%d",&k,&x);
return {k,x};
}
int main(){
int n; scanf("%d",&n);
int k,x;
tie(k,x)=ask(n%2==0?2:1,(n+1)/2);
while(1){
if(k<(n+1)/2){
tie(k,x)=ask(k,x+(n+2)/2);
}
else{
tie(k,x)=ask(k,x-(n+2)/2);
}
}
return 0;
}