結果

問題 No.355 数当てゲーム(2)
ユーザー h_noson
提出日時 2016-04-06 20:28:34
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 24 ms / 2,000 ms
コード長 1,406 bytes
コンパイル時間 487 ms
コンパイル使用メモリ 61,224 KB
実行使用メモリ 25,436 KB
平均クエリ数 30.69
最終ジャッジ日時 2024-07-16 23:33:27
合計ジャッジ時間 4,155 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 52
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

#define RREP(i,s,e) for (i = s; i >= e; i--)
#define rrep(i,n) RREP(i,n,0)
#define REP(i,s,e) for (i = s; i < e; i++)
#define rep(i,n) REP(i,0,n)
#define INF 100000000

typedef long long ll;

void out(int n1, int n2, int n3, int n4) {
    cout << n1 << " " << n2 << " " << n3 << " " << n4 << endl;
}

int main() {
    int i, j, k, l, x, y, mx;
    int n[4];
    mx = 0;
    rep (i,7) {
        out(i,7,8,9);
        cin >> x >> y;
        if (x == 4)
            return 0;
        if (mx < x+y) {
            n[0] = i;
            mx = x+y;
        }
    }
    mx = 0;
    REP (i,n[0]+1,8) {
        out(n[0],i,8,9);
        cin >> x >> y;
        if (x == 4)
            return 0;
        if (mx < x+y) {
            n[1] = i;
            mx = x+y;
        }
    }
    mx = 0;
    REP (i,n[1]+1,9) {
        out(n[0],n[1],i,9);
        cin >> x >> y;
        if (x == 4)
            return 0;
        if (mx < x+y) {
            n[2] = i;
            mx = x+y;
        }
    }
    mx = 0;
    REP (i,n[2]+1,10) {
        out(n[0],n[1],n[2],i);
        cin >> x >> y;
        if (x == 4)
            return 0;
        if (mx < x+y) {
            n[3] = i;
            mx = x+y;
        }
    }
    do {
        out(n[0],n[1],n[2],n[3]);
        cin >> x >> y;
    } while (x != 4 && next_permutation(n,n+4));
    return 0;
}
0