結果

問題 No.647 明太子
ユーザー 👑 naipianaipia
提出日時 2018-05-21 23:36:45
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 40 ms / 4,500 ms
コード長 750 bytes
コンパイル時間 1,142 ms
コンパイル使用メモリ 147,784 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-11 01:07:49
合計ジャッジ時間 2,892 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 3 ms
4,376 KB
testcase_10 AC 3 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 3 ms
4,380 KB
testcase_13 AC 4 ms
4,380 KB
testcase_14 AC 31 ms
4,380 KB
testcase_15 AC 6 ms
4,380 KB
testcase_16 AC 3 ms
4,380 KB
testcase_17 AC 38 ms
4,380 KB
testcase_18 AC 40 ms
4,380 KB
testcase_19 AC 8 ms
4,376 KB
testcase_20 AC 7 ms
4,376 KB
testcase_21 AC 4 ms
4,380 KB
testcase_22 AC 28 ms
4,376 KB
testcase_23 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    int N,M,in1,in2,x,y,max=0;
    vector<int> a,b,ans;

    cin >> N;
    for(int i=0;i<N;i++){
        cin >> in1 >> in2;
        a.push_back(in1);
        b.push_back(in2);
    }
    cin >> M;
    vector<int> num(M,0);
    for(int i=0;i<M;i++){
        cin >> x >> y;
        for(int j=0;j<N;j++){
            if(a[j]>=x && b[j]<=y) num[i]++;
        }
    }

    for(int i=0;i<M;i++){
        if(max<num[i]){
            max=num[i];
            ans.clear();
            ans.push_back(i+1);
        }else if(max==num[i]) ans.push_back(i+1);
    }
    if(max==0){
        cout << 0 << endl;
        return 0;
    }
    for(int i=0;i<ans.size();i++) cout << ans[i] << endl;

    return 0;
}
0