結果
| 問題 | No.355 数当てゲーム(2) | 
| コンテスト | |
| ユーザー |  srup٩(๑`н´๑)۶ | 
| 提出日時 | 2016-05-25 21:14:46 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                TLE
                                 
                            (最新) 
                                AC
                                 
                            (最初) | 
| 実行時間 | - | 
| コード長 | 1,403 bytes | 
| コンパイル時間 | 804 ms | 
| コンパイル使用メモリ | 83,660 KB | 
| 実行使用メモリ | 40,292 KB | 
| 最終ジャッジ日時 | 2024-07-16 23:45:30 | 
| 合計ジャッジ時間 | 7,182 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | TLE * 1 -- * 51 | 
コンパイルメッセージ
main.cpp: In function ‘void find(int, int, int, int)’:
main.cpp:45:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   45 |                         scanf("%d %d", &x, &y);
      |                         ~~~~~^~~~~~~~~~~~~~~~~
main.cpp: In function ‘int main()’:
main.cpp:72:54: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   72 |                                                 scanf("%d %d", &x, &y);
      |                                                 ~~~~~^~~~~~~~~~~~~~~~~
            
            ソースコード
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<pint> vpint;
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
int dx[4] = {1, 0, 0, -1};
int dy[4] = {0, 1, -1, 0};
void find(int a, int b, int c, int d){
	vector<int> vc(4);
	vc[0] = a;
	vc[1] = b;
	vc[2] = c;
	vc[3] = d;
	sort(all(vc));
	
	do{
		rep(i, 4){
			//クエリ出力
			printf("%d\n", vc[i]);
			//応答受けとり
			int x, y;
			scanf("%d %d", &x, &y);
			if (x == 4 && y == 0){
				rep(i, 4)
					printf("%d\n", vc[i]);
				return;
			}
		}
	}while(next_permutation(all(vc)));
	return;
}
int main(void){
	rep(i, 10){
		rep(j, 10){
			rep(k, 10){
				rep(l, 10){
					if (i != j && j != k && k != l && l != i)
					{
						printf("%d\n", i);
						printf("%d\n", j);
						printf("%d\n", k);
						printf("%d\n", l);
						int x, y;
						scanf("%d %d", &x, &y);
						if (x + y == 4)
						{
							find(i, j, k, l);
							return 0;
						}
					}
				}
			}
		}
	}
	return 0;
}
            
            
            
        