結果

問題 No.647 明太子
ユーザー vrjfsyivrjfsyi
提出日時 2018-02-11 23:14:11
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,054 bytes
コンパイル時間 546 ms
コンパイル使用メモリ 72,668 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-08-27 02:21:34
合計ジャッジ時間 2,576 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <array>
#include <vector>
#include <algorithm>

using namespace std;

int main() {

    int N;

    cin >> N;

    array<long, 1000> as{};
    array<long, 1000> bs{};

    for (int i = 0; i < N; ++i) {
        long a, b;
        cin >> a >> b;
        as[i] = a;
        bs[i] = b;
    }

    int M;
    cin >> M;

    array<long, 100> xs{};
    array<long, 100> ys{};

    for (int j = 0; j < M; ++j) {
        long x, y;
        cin >> x >> y;
        xs[j] = x;
        ys[j] = y;
    }

    vector<int> counters(M, 0);

    for (int k = 0; k < M; ++k) {
        for (int i = 0; i < N; ++i) {

            if (xs[k] <= as[i] && ys[k] >= bs[i]) {
                counters[k] += 1;
            }
        }
    }

    int maxElem = *std::max_element(counters.begin(), counters.end());

    if (maxElem == 0) {
        cout << 0 << endl;
        return 0;
    }


    for (int l = 0; l < M; ++l) {
        if (counters[l] == maxElem) {
            cout << (l + 1) << endl;
        }
    }

    cout << "\n";


    return 0;

}
0