結果

問題 No.647 明太子
ユーザー kekenxkekenx
提出日時 2020-04-03 12:51:18
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 40 ms / 4,500 ms
コード長 974 bytes
コンパイル時間 1,584 ms
コンパイル使用メモリ 172,352 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-11 03:14:55
合計ジャッジ時間 3,175 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

struct member {
  int a, b;
  member() {};
  member(int a_, int b_): a(a_), b(b_) {};
};

struct codroe {
  int x, y, id;
  codroe() {};
  codroe(int x_, int y_, int id_): x(x_), y(y_), id(id_) {};
};

int main() {
  int n;
  cin >> n;

  vector<member> members;
  for (int i = 0; i < n; ++i) {
    int a, b;
    cin >> a >> b;
    members.emplace_back(a, b);
  }

  int m;
  cin >> m;
  vector<codroe> codroes;
  for (int i = 0; i < m; ++i) {
    int x, y;
    cin >> x >> y;
    codroes.emplace_back(x, y, i);
  }

  vector<int> counts(m, 0);
  for (member mem: members) {
    for (codroe cod: codroes) {
      if (cod.x <= mem.a && cod.y >= mem.b) counts[cod.id]++;
    }
  }
  int ma = *max_element(counts.begin(), counts.end());

  if (ma == 0) {
    cout << 0 << '\n';
  } else {
    for (int i = 0; i < m; ++i) {
      if (counts[i] == ma) {
	cout << i + 1 << '\n';
      }
    }
  }
  return 0;
}
0