結果

問題 No.647 明太子
ユーザー dazydazy
提出日時 2018-05-12 19:51:24
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,207 bytes
コンパイル時間 1,322 ms
コンパイル使用メモリ 146,200 KB
実行使用メモリ 12,080 KB
最終ジャッジ日時 2023-09-10 18:30:30
合計ジャッジ時間 13,494 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:45:18: warning: ‘count’ may be used uninitialized in this function [-Wmaybe-uninitialized]
             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) {
            h++;
            k.push_back(h);
            count--;
        }
    }

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