結果
| 問題 |
No.355 数当てゲーム(2)
|
| コンテスト | |
| ユーザー |
tkmst201
|
| 提出日時 | 2017-04-20 22:33:07 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 31 ms / 2,000 ms |
| コード長 | 1,355 bytes |
| コンパイル時間 | 1,566 ms |
| コンパイル使用メモリ | 161,636 KB |
| 実行使用メモリ | 25,452 KB |
| 平均クエリ数 | 26.12 |
| 最終ジャッジ日時 | 2024-07-17 00:54:43 |
| 合計ジャッジ時間 | 6,448 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 52 |
コンパイルメッセージ
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, 10) 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;
}
tkmst201