結果
| 問題 |
No.355 数当てゲーム(2)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-11-27 19:34:07 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,169 bytes |
| コンパイル時間 | 1,664 ms |
| コンパイル使用メモリ | 179,196 KB |
| 実行使用メモリ | 25,844 KB |
| 平均クエリ数 | 10.00 |
| 最終ジャッジ日時 | 2024-07-16 11:24:55 |
| 合計ジャッジ時間 | 14,110 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 52 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
signed main(){
set< tuple< int, int, int, int > > cand;
for( int i = 0; i < 10; ++i )
for( int j = 0; j < 10; ++j )
for( int k = 0; k < 10; ++k )
for( int l = 0; l < 10; ++l )
cand.emplace( i, j, k, l );
while( not cand.empty() ){
int a, b, c, d; tie( a, b, c, d ) = *cand.begin();
cout << a << " " << b << " " << c << " " << d << endl;
int x, y; cin >> x >> y; // exactly same / different pos but has
if( x == 4 and y == 0 )
exit( 0 );
set< tuple< int, int, int, int > > ncand;
for( auto it = cand.begin(); it != cand.end(); ++it ){
int sx = 0, sy = 0;
int e, f, g, h; tie( e, f, g, h ) = *it;
sx = ( a == e ) + ( b == f ) + ( c == g ) + ( d == h );
if( a != e and ( a == f or a == g or a == h ) )
++sy;
if( b != f and ( b == e or b == g or b == h ) )
++sy;
if( c != g and ( c == e or c == f or c == h ) )
++sy;
if( d != h and ( d == e or d == f or d == g ) )
++sy;
if( sx == x and sy == y )
ncand.emplace( e, f, g, h );
}
swap( cand, ncand );
}
return 0;
}