結果
問題 | No.2357 Guess the Function |
ユーザー |
![]() |
提出日時 | 2023-06-23 22:52:37 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 54 ms / 1,000 ms |
コード長 | 1,004 bytes |
コンパイル時間 | 1,186 ms |
コンパイル使用メモリ | 124,788 KB |
最終ジャッジ日時 | 2025-02-15 01:26:04 |
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 10 |
ソースコード
#include <algorithm>#include <bit>#include <cassert>#include <cstdio>#include <cstdlib>#include <cmath>#include <deque>#include <iostream>#include <map>#include <random>#include <unordered_set>#include <unordered_map>#include <vector>#include <set>#include <string>using namespace::std;template <typename T>void print(const T& v) {for (const auto& x : v) cout << x << " ";cout << endl;}int main() {ios::sync_with_stdio(false);cout << "? 50" << endl;int u;cin >> u;vector<pair<int, int>> p;for (int a = 0; a < 100; ++a)for (int b = a + 1; b <= 100; ++b)if ((a + 50) % b == u)p.push_back({a, b});int y = 1;unordered_map<int, pair<int, int>> m;for (; y <= 100; ++y) {for (const auto& [a, b] : p)m[(a + y) % b] = {a, b};if (m.size() == p.size()) break;else m.clear();}cout << "? " << y << endl;int w;cin >> w;cout << "! " << m[w].first << " " << m[w].second << endl;return 0;}