結果
問題 | No.647 明太子 |
ユーザー |
|
提出日時 | 2018-02-09 22:48:23 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 28 ms / 4,500 ms |
コード長 | 826 bytes |
コンパイル時間 | 1,499 ms |
コンパイル使用メモリ | 170,848 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-27 02:32:03 |
合計ジャッジ時間 | 2,416 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;int main() {cin.tie(0);ios::sync_with_stdio(false);int n;cin >> n;vector<int> a(n), b(n);for (int i = 0; i < n; i++) {cin >> a[i] >> b[i];}int m;cin >> m;vector<int> x(m), y(m);for (int i = 0; i < m; i++) {cin >> x[i] >> y[i];}vector<int> cnt(m, 0);for (int i = 0; i < n; i++) {for (int j = 0; j < m; j++) {cnt[j] += (x[j] <= a[i] && y[j] >= b[i]);}}int maxv = 0;for (int i = 0; i < m; i++) {maxv = max(maxv, cnt[i]);}if (maxv == 0) {cout << 0 << endl;} else {for (int i = 0; i < m; i++) {if (cnt[i] == maxv) cout << i + 1 << endl;}}return 0;}