結果

問題 No.647 明太子
ユーザー kichirb3
提出日時 2018-03-02 08:56:50
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 1,474 ms / 4,500 ms
コード長 841 bytes
コンパイル時間 216 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-06-27 02:47:35
合計ジャッジ時間 5,723 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-
"""
No.647 明太子
https://yukicoder.me/problems/no/647

"""
import sys
from sys import stdin

input = stdin.readline


def main(args):
    N = int(input())
    criteria = []
    for _ in range(N):
        A, B = map(int, input().split())
        criteria.append([A, B])

    M = int(input())
    mentaiko = []
    for _ in range( M):
        X, Y = map(int, input().split())
        mentaiko.append([X, Y])

    votes = [0] * M
    for A, B in criteria:
        for i, m in zip(range(M), mentaiko):
            X, Y = m[0], m[1]
            if (X <= A and Y >= B):
                votes[i] += 1

    max_vote = max(votes)
    if max_vote == 0:
        print(0)
    else:
        for i in range(M):
            if votes[i] == max_vote:
                print(i+1)


if __name__ == '__main__':
    main(sys.argv[1:])
0