結果

問題 No.647 明太子
ユーザー packer_jppacker_jp
提出日時 2018-02-09 22:31:44
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 40 ms / 4,500 ms
コード長 885 bytes
コンパイル時間 1,138 ms
コンパイル使用メモリ 143,708 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-09 09:21:57
合計ジャッジ時間 2,346 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

#define int long long

int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int N, M;
int A[10000], B[10000], X[1000], Y[1000];
int k[1000] = {};

signed main() {
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> A[i] >> B[i];
    }
    cin >> M;
    for (int i = 0; i < M; i++) {
        cin >> X[i] >> Y[i];
    }
    for (int i = 0; i < M; i++) {
        for (int j = 0; j < N; j++) {
            if (X[i] <= A[j] && Y[i] >= B[j]) {
                k[i]++;
            }
        }
    }
    int bg = 0;
    for (int i = 0; i < M; i++) {
        bg = max(bg, k[i]);
    }
    if (bg == 0) {
        cout << 0 << endl;
        return 0;
    }
    for (int i = 0; i < M; i++) {
        if (k[i] == bg) {
            cout << i + 1 << endl;
        }
    }
    return 0;
}
0