結果
問題 |
No.1149 色塗りゲーム
|
ユーザー |
|
提出日時 | 2020-08-07 21:32:15 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 470 bytes |
コンパイル時間 | 2,153 ms |
コンパイル使用メモリ | 192,892 KB |
最終ジャッジ日時 | 2025-01-12 15:54:37 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 2 TLE * 48 |
コンパイルメッセージ
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:12:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | scanf("%d%d",&k,&x); | ~~~~~^~~~~~~~~~~~~~ main.cpp: In function ‘int main()’: main.cpp:18:21: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 18 | 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==0) exit(0); scanf("%d%d",&k,&x); return {k,x}; } int main(){ int n; scanf("%d",&n); if(n<=2) ask(n,1); int k,x; tie(k,x)=ask((n+1)/2,n%2==0?2:1); while(1){ if(k<(n+1)/2){ tie(k,x)=ask(k+(n+1)/2,x); } else{ tie(k,x)=ask(k-(n+1)/2,x); } } return 0; }