結果
問題 |
No.2828 Remainder Game
|
ユーザー |
![]() |
提出日時 | 2024-08-02 22:38:24 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,262 bytes |
コンパイル時間 | 910 ms |
コンパイル使用メモリ | 87,580 KB |
実行使用メモリ | 25,556 KB |
平均クエリ数 | 12.00 |
最終ジャッジ日時 | 2024-08-02 22:38:28 |
合計ジャッジ時間 | 3,805 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 2 WA * 18 |
ソースコード
#include <iostream> #include <vector> #include <unordered_map> #include <cmath> // Function to query the judge int query(int M, const std::vector<int>& R) { int K = R.size(); std::cout << M << " " << K << std::endl; for (int i = 0; i < K; ++i) { std::cout << R[i]; if (i != K-1) std::cout << " "; } std::cout << std::endl; std::cout.flush(); int response; std::cin >> response; return response; } // Function to make the final guess void final_guess(int S) { std::cout << "0 1" << std::endl; std::cout << S << std::endl; std::cout.flush(); } int main() { int N; std::cin >> N; // Variables to store the sum and the counts of remainders int sum = 0; std::unordered_map<int, int> remainder_count; // Using M values and querying remainder sets int M = 5; // Start with a small M for (int r = 0; r < M; ++r) { std::vector<int> R = {r}; int count = query(M, R); remainder_count[r] = count; } // Calculate the sum based on remainder counts and M for (const auto& pair : remainder_count) { sum += pair.first * pair.second; } // Making the final guess final_guess(sum); return 0; }