結果
| 問題 |
No.3069 Invisible Speedrun
|
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2025-03-23 19:23:26 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 84 ms / 2,000 ms |
| コード長 | 577 bytes |
| コンパイル時間 | 547 ms |
| コンパイル使用メモリ | 39,800 KB |
| 実行使用メモリ | 25,972 KB |
| 平均クエリ数 | 585.15 |
| 最終ジャッジ日時 | 2025-03-23 19:23:36 |
| 合計ジャッジ時間 | 9,276 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 80 |
コンパイルメッセージ
main.cpp: In function ‘int query(int)’:
main.cpp:26:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
26 | scanf("%d", &v);
| ~~~~~^~~~~~~~~~
main.cpp: In function ‘int main()’:
main.cpp:35:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
35 | scanf("%d", &n);
| ~~~~~^~~~~~~~~~
ソースコード
/* -*- coding: utf-8 -*-
*
* 3069.cc: No.3069 Invisible Speedrun - yukicoder
*/
#include<cstdio>
#include<algorithm>
using namespace std;
/* constant */
const char dcs[] = "DR";
enum { D, R };
/* typedef */
/* global variables */
/* subroutines */
int query(int di) {
putchar(dcs[di]); putchar('\n'); fflush(stdout);
int v;
scanf("%d", &v);
if (v < 0) exit(0);
return v;
}
/* main */
int main() {
int n;
scanf("%d", &n);
for (int di = D;; di ^= 1) {
int v = query(di);
if (v) break;
}
//for (int i = 0; i < 1e9; i++);
return 0;
}
tnakao0123