結果

問題 No.647 明太子
ユーザー squid
提出日時 2018-02-09 22:34:15
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 711 bytes
コンパイル時間 1,995 ms
コンパイル使用メモリ 157,404 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-26 07:38:57
合計ジャッジ時間 3,363 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 2
other AC * 15 WA * 5
権限があれば一括ダウンロードができます

ソースコード

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]++;
            }
        }
    }
    int ans=distance(cnt_ment,max_element(cnt_ment,&cnt_ment[m]));
    cout<<ans+1<<endl;

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