結果

問題 No.647 明太子
ユーザー ninoinui
提出日時 2020-02-14 01:33:05
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 35 ms / 4,500 ms
コード長 653 bytes
コンパイル時間 1,659 ms
コンパイル使用メモリ 172,496 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-06 06:48:51
合計ジャッジ時間 2,597 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<pair<int, int>> AB(N), XY;
  for (int i = 0, a, b; i < N && cin >> a >> b; i++) AB.at(i) = {a, b};
  int M;
  cin >> M;
  XY.resize(M);
  for (int i = 0, x, y; cin >> x >> y; i++) XY.at(i) = {x, y};
  vector<int> V(M);
  for (int i = 0; i < N; i++)
    for (int j = 0; j < M; j++)
      if (AB.at(i).first >= XY.at(j).first && AB.at(i).second <= XY.at(j).second) V.at(j)++;
  int ma = *max_element(V.begin(), V.end());
  if (!ma) return cout << 0 << "\n", 0;
  for (int i = 0; i < M; i++) if (V.at(i) == ma) cout << i + 1 << "\n";
}
0