結果
問題 | No.2357 Guess the Function |
ユーザー |
![]() |
提出日時 | 2023-06-23 23:59:04 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 31 ms / 1,000 ms |
コード長 | 2,638 bytes |
コンパイル時間 | 1,129 ms |
コンパイル使用メモリ | 123,344 KB |
最終ジャッジ日時 | 2025-02-15 01:43:44 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 10 |
ソースコード
#include <iostream>#include <algorithm>#include <iomanip>#include <vector>#include <queue>#include <deque>#include <set>#include <map>#include <tuple>#include <cmath>#include <numeric>#include <functional>#include <cassert>#define debug_value(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << #x << "=" << x << endl;#define debug(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << x << endl;template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }using namespace std;typedef long long ll;template<typename T>vector<vector<T>> vec2d(int n, int m, T v){return vector<vector<T>>(n, vector<T>(m, v));}template<typename T>vector<vector<vector<T>>> vec3d(int n, int m, int k, T v){return vector<vector<vector<T>>>(n, vector<vector<T>>(m, vector<T>(k, v)));}template<typename T>void print_vector(vector<T> v, char delimiter=' '){if(v.empty()) {cout << endl;return;}for(int i = 0; i+1 < v.size(); i++) cout << v[i] << delimiter;cout << v.back() << endl;}using P = pair<int, int>;void test(){for(int x = 1; x <= 100; x++){set<int> st;for(int a = 0; a <= 99; a++){int b = a+1;int r0 = (a+x)%b;st.insert(r0);}debug_value(st.size())if(st.size() == 100){cout << x << ' ' << endl;return;}}debug_value("DONE")}void test0(){int mx = 0;for(int x = 1; x <= 100; x++){for(int y = x+1; y <= 100; y++){set<P> st;for(int a = 0; a <= 99; a++){for(int b = a+1; b <= 100; b++){int r0 = (a+x)%b;int r1 = (a+y)%b;st.insert({r0, r1});}}chmax<int>(mx, st.size());// debug(st.size())if(st.size() == 5050){cout << x << ' ' << y << endl;return;}}}debug_value(mx)debug_value("DONE")}int main(){ios::sync_with_stdio(false);cin.tie(0);cout << setprecision(10) << fixed;auto f = [&](int x){cout << "? " << x << endl;int ans; cin >> ans;return ans;};int a0 = f(100);if(a0 == 99){cout << "! " << 99 << ' ' << 100 << endl;return 0;}int B = f(100-a0-1)+1;int A = (a0-100)%B;A += B;A %= B;cout << "! " << A << ' ' << B << endl;}