結果

問題 No.647 明太子
ユーザー stderrstderr
提出日時 2018-02-09 23:11:59
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 40 ms / 4,500 ms
コード長 1,112 bytes
コンパイル時間 649 ms
コンパイル使用メモリ 62,852 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-09 09:26:23
合計ジャッジ時間 1,666 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 3 ms
4,376 KB
testcase_10 AC 3 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 3 ms
4,376 KB
testcase_13 AC 4 ms
4,380 KB
testcase_14 AC 30 ms
4,376 KB
testcase_15 AC 6 ms
4,380 KB
testcase_16 AC 3 ms
4,376 KB
testcase_17 AC 37 ms
4,380 KB
testcase_18 AC 40 ms
4,376 KB
testcase_19 AC 8 ms
4,380 KB
testcase_20 AC 7 ms
4,376 KB
testcase_21 AC 4 ms
4,380 KB
testcase_22 AC 30 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repR(i, n) for(int i = (n) - 1; i > -1; i--)
#define rep1(i, n) for(int i = 1; i < (int)(n + 1); i++)
#define rep1R(i, n) for(int i = (n); i > 0; i--)
#define ll long long
using namespace std;

const int N_MAX = 10000;
const int M_MAX = 1000;
int A[N_MAX];
int B[N_MAX];
int X[M_MAX];
int Y[M_MAX];
int cnt[M_MAX] = {};

int main() {
  int N;
  cin >> N;
  rep(i, N) {
    cin >> A[i] >> B[i];
  }
  int M;
  cin >> M;
  rep(i, M) {
    cin >> X[i] >> Y[i];
  }
  bool flag = false;
  rep(i, N) {
    rep(j, M) {
      if (A[i] >= X[j] && B[i] <= Y[j]) {
        cnt[j]++;
        flag = true;
      }
    }
  }
  if (!flag) {
    cout << 0 << endl;
    return 0;
  }
  // rep(i, M) cout << cnt[i] << " ";
  // cout << endl;
  int* it = max_element(cnt, cnt + M);
  int maximum = *it;
  cout << distance(cnt, it) + 1 << endl;
  it = find(it + 1, cnt + M, maximum);
  while (it != cnt + M) {
    cout << distance(cnt, it) + 1 << endl;
    it = find(it + 1, cnt + M, maximum);
  }
  return 0;
}
0