結果
問題 | No.355 数当てゲーム(2) |
ユーザー |
![]() |
提出日時 | 2017-04-20 22:31:02 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,356 bytes |
コンパイル時間 | 1,884 ms |
コンパイル使用メモリ | 162,560 KB |
実行使用メモリ | 25,580 KB |
平均クエリ数 | 27.52 |
最終ジャッジ日時 | 2024-07-17 00:54:36 |
合計ジャッジ時間 | 6,174 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 51 WA * 1 |
コンパイルメッセージ
main.cpp: In function ‘pii get()’: main.cpp:29:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 29 | scanf("%d %d", &res.first, &res.second); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>using namespace std;#define FOR(i,a,b) for(int i=(a);i<(b);i++)#define REP(i,n) FOR(i,0,n)#define ALL(v) (v).begin(),(v).end()template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }typedef unsigned long long ull;typedef long long ll;typedef pair<int, int> pii;typedef pair<ll, ll> pll;typedef pair<int, pii> P;const ll INF = 1ll<<29;const ll MOD = 1000000007;const double EPS = 1e-10;void print(int pr[4]) {REP(i, 4) printf("%d%c", pr[i], i == 3 ? '\n' : ' ');fflush(stdout);}pii get() {pii res;scanf("%d %d", &res.first, &res.second);return res;}int main() {srand((unsigned int)time(NULL));int ans[4], ng[4];vector<int> ord;REP(i, 10) ord.push_back(i);while (true) {REP(i, 100) swap(ord[rand() % 10], ord[rand() % 10]);REP(i, 4) ng[i] = ord[i];print(ng);pii now = get();if (now.first == 0 && now.second == 0) break;}REP(i, 4) ord.erase( find(ALL(ord), ng[i]) );REP(i, 4) {int tmp = ng[i];REP(j, ord.size()) {ng[i] = ord[j];print(ng);pii now = get();if (now.first == 1 && now.second == 0) break;}ans[i] = ng[i];ng[i] = tmp;}print(ans);return 0;}