結果

問題 No.304 鍵(1)
ユーザー anta
提出日時 2015-11-27 23:40:25
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 50 ms / 2,000 ms
コード長 400 bytes
コンパイル時間 588 ms
コンパイル使用メモリ 71,184 KB
実行使用メモリ 24,964 KB
平均クエリ数 459.17
最終ジャッジ日時 2024-07-16 21:51:36
合計ジャッジ時間 1,374 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:17:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   17 |                 scanf("%s", buf);
      |                 ~~~~~^~~~~~~~~~~

ソースコード

diff #

#include <random>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <numeric>
using namespace std;

int main() {
	vector<int> v(1000);
	iota(v.begin(), v.end(), 0);
	default_random_engine re(random_device{}());
	shuffle(v.begin(), v.end(), re);
	for(int x : v) {
		printf("%03d\n", x);
		fflush(stdout);
		char buf[10];
		scanf("%s", buf);
		if(*buf == 'u')
			break;
	}
	return 0;
}
0