結果
問題 |
No.647 明太子
|
ユーザー |
![]() |
提出日時 | 2020-01-14 00:11:42 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 43 ms / 4,500 ms |
コード長 | 950 bytes |
コンパイル時間 | 1,968 ms |
コンパイル使用メモリ | 193,584 KB |
最終ジャッジ日時 | 2025-01-08 17:51:17 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
ソースコード
#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); } if (t == 0) cout << 0 << endl; else{ for (int i = 0; i < m; i++){ if (t == count[i]) cout << i+1 << endl; } } return 0; }