結果

問題 No.647 明太子
ユーザー Konton7Konton7
提出日時 2020-01-14 00:09:04
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 876 bytes
コンパイル時間 2,183 ms
コンパイル使用メモリ 198,964 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-08-24 20:48:15
合計ジャッジ時間 4,187 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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