結果

問題 No.647 明太子
ユーザー dazydazy
提出日時 2018-05-12 19:53:04
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 1,205 bytes
コンパイル時間 1,425 ms
コンパイル使用メモリ 146,140 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-09-10 18:30:37
合計ジャッジ時間 6,427 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:40:9: warning: ‘h’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     int h;
         ^
main.cpp:41:11: warning: ‘count’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     while(count) {
           ^~~~~
main.cpp:42:9: warning: ‘max’ may be used uninitialized in this function [-Wmaybe-uninitialized]
         if(m[h][2] == max) {
         ^~

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define fastcin {\
    cin.tie(0);\
    ios::sync_with_stdio(false);\
}
#define REP(i, a, b) for(int i = a; i < b; i++)
#define RREP(i, a, b) for(int i = a; i > b; i--)
#define print(x) cout << x << "\n"
#define SORT(a, n) sort(a, a+n);
#define REVERSE(a,n) reverse(a,a+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VREVERSE(v) reverse(v.begin(), v.end());
#define MOD 1000000007
typedef long long ll;

int main() {
    fastcin;
    int N;
    cin >> N;
    int q[10000][2];
    REP(i, 0, N) cin >> q[i][0] >> q[i][1];

    int M;
    cin >> M;
    int m[1000][3] = {}, max, count;
    REP(i, 0, M) {
        cin >> m[i][0] >> m[i][1];
        REP(j, 0, N) {
            if(m[i][0]<=q[j][0] && m[i][1]>=q[j][1]) m[i][2]++;
        }
        if(max < m[i][2]) {
            max = m[i][2];
            count = 1;
        }
        else if(max > 0 && max == m[i][2]) count++;
    }

    vector<int> k;
    int h;
    while(count) {
        if(m[h][2] == max) {
            k.push_back(h+1);
            count--;
        }
        h++;
    }

    int s = k.size();
    if(s==0) print(0);
    else {
        REP(i, 0, s) print(k[i]);
    }
    return 0;
}
0