結果

問題 No.647 明太子
ユーザー tokutarotokutaro
提出日時 2020-03-27 05:15:07
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 307 ms / 4,500 ms
コード長 1,019 bytes
コンパイル時間 879 ms
コンパイル使用メモリ 86,680 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-30 16:05:23
合計ジャッジ時間 3,338 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#define REP(i, n) for (int i = 0; i < n; i++)
using namespace std;

int main(void) {
    int N;
    cin>>N;
    vector<int> A,B;
    REP(i, N) {
        int a,b;
        cin>>a>>b;
        A.push_back(a);
        B.push_back(b);
    }
    int M;
    cin>>M;
    map<int, int> mp;
    REP(i, M) {
        int X,Y;
        cin>>X>>Y;
        REP(j, N) {
            if (A.at(j) < X || B.at(j) > Y) continue;
            if (mp.find(i) != mp.end()) mp[i] += 1;
            else mp[i] = 1;
        }
    }
    vector<int> test;
    for (map<int, int>::iterator it = mp.begin(); it != mp.end(); ++it) test.push_back(it->second);
    if (test.size() == 0) {
        cout << 0 << endl;
        return 0;
    }
    sort(test.begin(), test.end());
    int maximum = test.at(test.size() - 1);
    for (map<int, int>::iterator it = mp.begin() ; it != mp.end(); ++it) {
        if (it->second == maximum) cout << it->first + 1 << endl;
    }
    return 0;
}
0