結果

問題 No.647 明太子
ユーザー squidsquid
提出日時 2018-02-09 22:42:41
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 43 ms / 4,500 ms
コード長 1,010 bytes
コンパイル時間 1,320 ms
コンパイル使用メモリ 146,068 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-09 09:23:55
合計ジャッジ時間 2,561 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
4,376 KB
testcase_01 AC 17 ms
4,380 KB
testcase_02 AC 17 ms
4,380 KB
testcase_03 AC 16 ms
4,376 KB
testcase_04 AC 17 ms
4,384 KB
testcase_05 AC 17 ms
4,376 KB
testcase_06 AC 17 ms
4,376 KB
testcase_07 AC 17 ms
4,376 KB
testcase_08 AC 16 ms
4,376 KB
testcase_09 AC 16 ms
4,380 KB
testcase_10 AC 15 ms
4,376 KB
testcase_11 AC 14 ms
4,376 KB
testcase_12 AC 16 ms
4,380 KB
testcase_13 AC 16 ms
4,376 KB
testcase_14 AC 36 ms
4,380 KB
testcase_15 AC 17 ms
4,376 KB
testcase_16 AC 15 ms
4,376 KB
testcase_17 AC 41 ms
4,380 KB
testcase_18 AC 43 ms
4,376 KB
testcase_19 AC 16 ms
4,376 KB
testcase_20 AC 15 ms
4,376 KB
testcase_21 AC 15 ms
4,380 KB
testcase_22 AC 26 ms
4,380 KB
testcase_23 AC 15 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

//constant
const long long int inf = 1<<30;
const int N = 1e4+1;
const int M = 1e3+1;

//variable
int cnt_ment[M];
int a[N],b[N];
int x[M],y[M];

//function


int main()
{
    int n,m;
    cin>>n;
    for(int i=0; i<n; i++){
        cin>>a[i]>>b[i];
    }
    cin>>m;
    for(int i=0; i<m; i++){
        cin>>x[i]>>y[i];
    }

    for(int i=0; i<N; i++){
        for(int j=0; j<M; j++){
            if(a[i]>=x[j]&&b[i]<=y[j]){
                cnt_ment[j]++;
            }
        }
    }
   vector<int> ans;
   int maxi=-1;
   for(int i=0; i<m; i++){
        int pre=maxi;
        maxi=max(maxi,cnt_ment[i]);
        if(pre!=maxi){
            ans.clear();
        }
        if(maxi==cnt_ment[i]){
            ans.push_back(i);
        }
   }
   if(maxi==0){
        cout<<0<<endl;
        return 0;
   }
   for(int i=0; i<ans.size(); i++){
        cout<<ans[i]+1<<endl;
   }

    /*for(int i=0; i<m; i++){
        cout<<cnt_ment[i]<<' ';
    }*/
    return 0;
}
0