結果
問題 |
No.355 数当てゲーム(2)
|
ユーザー |
![]() |
提出日時 | 2016-08-20 19:36:51 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 25 ms / 2,000 ms |
コード長 | 1,278 bytes |
コンパイル時間 | 892 ms |
コンパイル使用メモリ | 85,888 KB |
実行使用メモリ | 25,232 KB |
平均クエリ数 | 41.10 |
最終ジャッジ日時 | 2024-07-17 00:19:51 |
合計ジャッジ時間 | 4,531 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 52 |
ソースコード
#include <iostream> #include <fstream> #include <vector> #include <cstring> #include <string> #include <algorithm> #include <iomanip> #include <deque> #include <cassert> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); vector<int> a; for(int i = 0; i < 10; i++) { deque<int> v; for(int j = 0; j < 10; j++) { if(i != j) v.push_back(j); } int sum = 0; for(int j = 0; j < 3; j++) { cout << i << " "; for(int k = 0; k < 3; k++) { cout << v.front() << " "; v.pop_front(); } cout << endl; cout.flush(); int x, y; cin >> x >> y; if(x == 4) return 0; sum += x + y; } if(sum == 6) { a.push_back(i); } } assert(a.size() == 4); bool used[4] = { 0 }; for(int i = 0; i < 4; i++) { for(int j = 0; j < 4; j++) { for(int k = 0; k < 4; k++) { for(int l = 0; l < 4; l++) { int ans[4] = { a[i], a[j], a[k], a[l] }; bool flag = true; for(int m = 0; m < 4; m++) { for(int n = m + 1; n < 4; n++) { if(ans[n] == ans[m]) flag = false; } } if(flag) { for(int m = 0; m < 4; m++) { cout << ans[m] << " "; } cout << endl; cout.flush(); int x, y; cin >> x >> y; if(x == 4) return 0; } } } } } }