結果

問題 No.231 めぐるはめぐる (1)
ユーザー aitdccd
提出日時 2018-01-28 20:16:55
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 568 bytes
コンパイル時間 1,973 ms
コンパイル使用メモリ 165,844 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-29 15:27:12
合計ジャッジ時間 2,783 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 11
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:27:27: warning: 'idx' may be used uninitialized [-Wmaybe-uninitialized]
   27 |         REP(j, 6) cout << idx << endl;
      |                           ^~~
main.cpp:14:21: note: 'idx' was declared here
   14 |     int maxGD = -1, idx;
      |                     ^~~

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define REP(i, n) for(int i = 0; i < n; i++)

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n;
    cin >> n;
    int maxGD = -1, idx;
    REP(i, n) {
        int g, d;
        cin >> g >> d;
        if (g - 30000 * d > maxGD) {
            maxGD = g - 30000 * d;
            idx = i + 1;
        };
    }


    if (maxGD * 6 >= 30000 * 100) {
        cout << "YES" << endl;
        REP(j, 6) cout << idx << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}
0