結果

問題 No.355 数当てゲーム(2)
ユーザー ngtkana
提出日時 2020-04-05 23:10:44
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 1,026 bytes
コンパイル時間 1,946 ms
コンパイル使用メモリ 196,664 KB
最終ジャッジ日時 2025-01-09 14:26:11
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 52
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define ALL(v) std::begin(v),std::end(v)
using lint=long long;
using lubl=long double;
lint perf,good;
std::vector<lint>now;
lint query(){
    for(lint i=0;i<4;i++){
        std::cout<<(i?" ":"")<<now.at(i);
    }
    std::cout<<std::endl;
    std::cin>>perf>>good;
    if(perf==4&&good==0)exit(0);
    return perf;
}
#define ENABLE_DEBUG 1
#ifdef NGTKANA
#include<debug.hpp>
#else
#define DEBUG(...)(void)0
#endif
int main(){
    std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
    std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
    std::vector<lint>ans(4,-1);
    now.resize(4);
    for(lint i=0;i<2;i++){
        std::iota(ALL(now),i*5);
        lint basic=query();
        for(lint j=0;j<4;j++){
            for(lint k=!i*5;k<(!i+1)*5;k++){
                now.at(j)=k;
                if(basic<query()){
                    ans.at(j)=k;
                    break;
                }
            }
            now.at(j)=i*5+j;
        }
    }
    now=ans;
    query();
}
0