結果

問題 No.647 明太子
ユーザー kappybarkappybar
提出日時 2020-05-20 16:42:27
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 40 ms / 4,500 ms
コード長 1,009 bytes
コンパイル時間 1,915 ms
コンパイル使用メモリ 169,284 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-09 23:02:19
合計ジャッジ時間 3,203 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;

int main(){
    int n;
    cin >> n;
    vector<P> ab(n);
    rep(i,n) cin >> ab[i].first >> ab[i].second;
    int m;
    cin >> m;
    vector<P> xy(m);
    rep(i,m) cin >> xy[i].first >> xy[i].second;
    vector<int> cnt(m);
    rep(i,n)rep(j,m){
        if(xy[j].first <= ab[i].first && ab[i].second <= xy[j].second){
            cnt[j] ++;
        }
    }
    int mx = 0;
    vector<int> idx;
    rep(i,m){
        if(cnt[i]==0) continue;
        if(cnt[i] > mx){
            mx = cnt[i];
            idx = {i};
        }else if(cnt[i]==mx){
            idx.push_back(i);
        }
    }

    if(idx.size()==0) cout << 0 << endl;
    else{
        rep(i,idx.size()){
            cout << idx[i]+1 << endl;
        }
    }
    return 0;
}
0