結果
問題 | No.2357 Guess the Function |
ユーザー | 沙耶花 |
提出日時 | 2023-06-23 21:40:53 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 31 ms / 1,000 ms |
コード長 | 1,495 bytes |
コンパイル時間 | 4,748 ms |
コンパイル使用メモリ | 270,596 KB |
実行使用メモリ | 24,312 KB |
平均クエリ数 | 3.00 |
最終ジャッジ日時 | 2023-09-13 16:40:32 |
合計ジャッジ時間 | 5,486 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 31 ms
23,604 KB |
testcase_01 | AC | 26 ms
24,168 KB |
testcase_02 | AC | 25 ms
24,312 KB |
testcase_03 | AC | 24 ms
24,300 KB |
testcase_04 | AC | 24 ms
23,952 KB |
testcase_05 | AC | 26 ms
23,400 KB |
testcase_06 | AC | 26 ms
23,580 KB |
testcase_07 | AC | 25 ms
23,352 KB |
testcase_08 | AC | 25 ms
23,568 KB |
testcase_09 | AC | 25 ms
23,340 KB |
testcase_10 | AC | 26 ms
24,276 KB |
ソースコード
#include <stdio.h> #include <atcoder/all> #include <bits/stdc++.h> using namespace std; using namespace atcoder; using mint = modint998244353; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 4000000000000000001 int query(int y){ cout<<"? "<<y<<endl; int r; cin>>r; return r; } int answer(int x,int y){ cout<<"! "<<x<<' '<<y<<endl; exit(0); } int is_unique(int x,int y){ map<pair<int,int>,pair<int,int>> mp; int c = 0; rep(i,101){ for(int j=i+1;j<=100;j++){ mp[make_pair((i+x)%j, (i+y)%j)] = make_pair(i,j); c++; } } return mp.size(); /* cout<<c<<','<<mp.size()<<endl; if(c!=mp.size())return false; return true; */ } int main(){ int AA = 100; int x = query(AA); for(int i=1;i<=100;i++){ set<int> S; int c = 0; rep(j,101){ for(int k=j+1;k<=100;k++){ if((j+AA)%k==x){ c++; S.insert((j+i)%k); } } } if(c==S.size()){ int y = query(i); rep(j,101){ for(int k=j+1;k<=100;k++){ if((j+AA)%k==x && (j+i)%k==y){ answer(j,k); } } } } else continue; } /* int y = query(100); rep(i,101){ for(int j=i+1;j<=100;j++){ if((i+1)%j==x&&(i+100)%j==y){ answer(i,j); } } } */ /* int t = 0; for(int i=1;i<=100;i++){ for(int j=i+1;j<=100;j++){ int r =is_unique(i,j); if(r>t){ t = r; cout<<r<<','<<i<<','<<j<<endl; } } } */ /* int A,B; int t = query(1); if(t==0){ } else{ A = t-1; } */ return 0; }