結果
| 問題 |
No.647 明太子
|
| コンテスト | |
| ユーザー |
neko_the_shadow
|
| 提出日時 | 2018-03-21 23:14:24 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 51 ms / 4,500 ms |
| コード長 | 671 bytes |
| コンパイル時間 | 758 ms |
| コンパイル使用メモリ | 76,460 KB |
| 最終ジャッジ日時 | 2025-01-05 09:18:43 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 |
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> as(n), bs(n);
for (int i = 0; i < n; i++) cin >> as[i] >> bs[i];
int m;
cin >> m;
vector<int> xs(m), ys(m);
for (int i = 0; i < m; i++) cin >> xs[i] >> ys[i];
vector<int> ranks(m, 0);
int maxx = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if (xs[j] <= as[i] && bs[i] <= ys[j]) {
ranks[j]++;
maxx = max(ranks[j], maxx);
}
}
}
vector<int> users;
if (maxx == 0) {
cout << 0 << endl;
} else {
for (int i = 0; i < m; i++) {
if (ranks[i] == maxx) {
cout << i + 1 << endl;
}
}
}
}
neko_the_shadow