結果
問題 | No.647 明太子 |
ユーザー |
|
提出日時 | 2018-02-09 23:14:34 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 42 ms / 4,500 ms |
コード長 | 892 bytes |
コンパイル時間 | 676 ms |
コンパイル使用メモリ | 68,980 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-27 02:35:36 |
合計ジャッジ時間 | 1,637 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
ソースコード
#include <iostream>#include <algorithm>#include <vector>#include <utility>#define rep(i, a, n) for(int i = a;i < n;i++)#define repe(i, a, n) for(int i = a;i <= n;i++)#define repr(i, a, n) for(int i = a;i > n;i--)using namespace std;int n, m;int a[10010], b[10100];int x[1010], y[1010];pair<int, int> vote[1010];void solve(){repe(i, 1, m) vote[i].second = i;repe(i, 1, n)repe(j, 1, m)if(x[j] <= a[i] && b[i] <= y[j]) vote[j].first++;sort(&vote[1], &vote[m+1]);vector<int> men;if(!vote[m].first){ cout << 0 << endl; return; }men.push_back(vote[m].second);repr(i, m-1, 0){if(vote[i].first != vote[i+1].first) break;men.push_back(vote[i].second);}sort(men.begin(), men.end());for(auto i : men) cout << i << endl;}int main(){cin >> n;repe(i, 1, n) cin >> a[i] >> b[i];cin >> m;repe(i, 1, m) cin >> x[i] >> y[i];solve();return 0;}