結果

問題 No.647 明太子
ユーザー CleyLCleyL
提出日時 2020-01-27 23:55:15
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 40 ms / 4,500 ms
コード長 978 bytes
コンパイル時間 1,009 ms
コンパイル使用メモリ 80,948 KB
実行使用メモリ 4,372 KB
最終ジャッジ日時 2023-10-12 18:05:45
合計ジャッジ時間 2,131 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef pair<int,int> P;
int main(){
    int n;cin>>n;
    vector<P> p(n);
    for(int i = 0; n > i; i++){
        cin>>p[i].first >> p[i].second;
    }
    
    int m;cin>>m;
    vector<P> f(m);
    vector<P> A(m);
    for(int i = 0; m > i; i++){
        cin>>f[i].first >> f[i].second;
        A[i].first = 0;
        A[i].second = i+1;
        
    }
    for(int i = 0; m > i; i++){
        for(int j = 0; n > j; j++){
            if(p[j].first >= f[i].first && p[j].second <= f[i].second){
                A[i].first++;
            }
        }
    }
    sort(A.begin(),A.end(),greater<P>());
    if(!A[0].first){
        cout << 0 << endl;
        return 0;
    }
    vector<int> Ans;
    for(int i = 0; A[0].first==A[i].first; i++){
        Ans.push_back(A[i].second);
    }
    sort(Ans.begin(),Ans.end());
    for(int i = 0; Ans.size() > i; i++){
        cout << Ans[i] << endl;
    }
    
}
0