結果

問題 No.231 めぐるはめぐる (1)
ユーザー MayimgMayimg
提出日時 2018-12-30 04:47:05
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 452 bytes
コンパイル時間 1,560 ms
コンパイル使用メモリ 162,968 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-15 05:32:15
合計ジャッジ時間 2,104 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:21:33: warning: 'idx' may be used uninitialized [-Wmaybe-uninitialized]
   21 |                         cout << idx << endl;
      |                                 ^~~
main.cpp:9:20: note: 'idx' was declared here
    9 |         int a = 0, idx;
      |                    ^~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0); 
	int n;
	cin >> n;
	int a = 0, idx;
	for(int i = 1; i <= n; i++) {
		int g, d;
		cin >> g >> d;
		if(g - d * 30000 > a) {
			idx = i;
			a = g - d * 30000;
		}
	}
	if(a * 6 >= 3000000) {
		cout << "YES" << endl;
		for(int i = 0; i < 6; i++) {
			cout << idx << endl;
		}
	} else {
		cout << "NO" << endl;
	}
	return 0;
}
0