結果

問題 No.647 明太子
ユーザー Konton7
提出日時 2020-01-14 00:09:04
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 876 bytes
コンパイル時間 2,003 ms
コンパイル使用メモリ 193,812 KB
最終ジャッジ日時 2025-01-08 17:51:05
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 17 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

struct mantaiko{
  int price = 0;
  int hot = 0;
};

int main(){
    int n, m, p, h, t;
    cin >> n;
    mantaiko ideal[n];
    for (int i = 0; i < n; i++){
        cin >> p >> h;
        ideal[i].price = p;
        ideal[i].hot = h;
    }
    cin >> m;
    mantaiko shop[m];
    int count[m] = {};
    for (int i = 0; i < m; i++){
        cin >> p >> h;
        shop[i].price = p;
        shop[i].hot = h;
    }
    
    t = 0;
    for (auto y : shop){
        for (auto x : ideal){
            if (x.price >= y.price && x.hot <= y.hot){
                count[t] += 1;
            }
        }
        t++;
    }
    
    t = 0;
    for (auto y : count){
        t = max(t, y);
    }
    
     for (int i = 0; i < m; i++){
        if (t == count[i])
            cout << i+1 << endl;
    }
    return 0;

}
0