結果
問題 | No.2357 Guess the Function |
ユーザー |
![]() |
提出日時 | 2023-06-23 21:40:53 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 31 ms / 1,000 ms |
コード長 | 1,495 bytes |
コンパイル時間 | 4,258 ms |
コンパイル使用メモリ | 259,572 KB |
最終ジャッジ日時 | 2025-02-15 00:42:32 |
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 10 |
ソースコード
#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; }