結果

問題 No.647 明太子
ユーザー どららどらら
提出日時 2018-02-09 22:29:16
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 182 ms / 4,500 ms
コード長 809 bytes
コンパイル時間 1,733 ms
コンパイル使用メモリ 175,396 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-09 09:21:30
合計ジャッジ時間 3,124 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


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

  vector<vector<int>> v;
  rep(i,N){
    int A, B;
    cin >> A >> B;
    v.push_back({A, B});
  }

  int M;
  cin >> M;

  map<int,int> cnt;
  rep(i,M){
    int X, Y;
    cin >> X >> Y;
    rep(j,N){
      if(X<=v[j][0] && Y>=v[j][1]) cnt[i]++;
    }
  }

  int mx = -1;
  FOR(it,cnt){
    mx = max(mx, it->second);
  }

  if(mx == -1){
    cout << 0 << endl;
  }else{
    FOR(it,cnt){
      if(it->second == mx) cout << it->first + 1 << endl;
    }
  }
  
  return 0;
}

0