結果
| 問題 |
No.647 明太子
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-02-10 02:25:51 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 312 ms / 4,500 ms |
| コード長 | 592 bytes |
| コンパイル時間 | 1,792 ms |
| コンパイル使用メモリ | 175,516 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-27 02:39:11 |
| 合計ジャッジ時間 | 2,994 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PI;
int main() {
int n;
cin >> n;
VI a(n), b(n);
for (int i = 0; i < n; i++) {
cin >> a[i] >> b[i];
}
int m;
cin >> m;
int ma = 0;
map<int, int> mp;
for (int i = 0; i < m; i++) {
int x, y;
cin >> x >> y;
for (int j = 0; j < n; j++) {
if (x <= a[j] && y >= b[j]) {
mp[i]++;
ma = max(ma, mp[i]);
}
}
}
if (mp.size()) {
for (auto e : mp)
if(e.second == ma)
cout << e.first + 1 << endl;
}
else {
cout << 0 << endl;
}
return 0;
}