結果
| 問題 |
No.355 数当てゲーム(2)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-05-17 16:11:21 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,184 bytes |
| コンパイル時間 | 451 ms |
| コンパイル使用メモリ | 57,524 KB |
| 実行使用メモリ | 25,964 KB |
| 平均クエリ数 | 1.00 |
| 最終ジャッジ日時 | 2024-07-16 10:10:03 |
| 合計ジャッジ時間 | 11,786 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 52 |
ソースコード
#include <iostream>
#include <list>
using namespace std;
list<int*> pt;
void est(const int o[], const int n[], int& x, int& y)
{
x = y = 0;
for ( int i = 0; i < 4; i++ ) {
if ( o[i] == n[i] ) {
x++;
}
else {
for ( int j = 0; j < 4; j++ ) {
if ( o[i] == n[j] ) {
y++;
break;
}
}
}
}
}
void io(int n[], int& x, int& y)
{
const static int o[] = { 0, 4, 3, 6 };
est(o, n, x, y);
}
int main()
{
for ( int i = 0; i < 10; i++ ) {
for ( int j = 0; j < 10; j++ ) {
if ( i == j ) continue;
for ( int k = 0; k < 10; k++ ) {
if ( i == k || j == k ) continue;
for ( int l = 0; l < 10; l++ ) {
if ( i == l || j == l || k == l ) continue;
int* n = new int[4] { i, j, k, l };
pt.push_back(n);
}
}
}
}
for ( ;; ) {
int x, y;
auto it = pt.begin();
int n[] = { (*it)[0], (*it)[1], (*it)[2], (*it)[3] };
io(n, x, y);
if ( x == 4 ) {
break;
}
do {
int xt, yt;
int o[] = { (*it)[0], (*it)[1], (*it)[2], (*it)[3] };
est(*it, n, xt, yt);
auto t_it = it++;
if ( x != xt || y != yt ) {
pt.erase(t_it);
}
else {
int a = 0;
}
}
while ( it != pt.end() );
}
return 0;
}