結果
| 問題 | No.647 明太子 |
| コンテスト | |
| ユーザー |
lunnear
|
| 提出日時 | 2018-11-14 16:05:45 |
| 言語 | C++11(廃止可能性あり) (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,164 bytes |
| 記録 | |
| コンパイル時間 | 466 ms |
| コンパイル使用メモリ | 54,908 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-24 13:43:20 |
| 合計ジャッジ時間 | 1,591 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 4 |
| other | AC * 4 WA * 16 |
ソースコード
#include <iostream>
struct Mentai
{
int Price;
int Hot;
};
int main()
{
int n, m;
int *bought;
Mentai *member;
Mentai *mentai;
std::cin >> n;
member = new Mentai[n];
for(int i = 0; i < n; i++)
{
std::cin >> member[i].Price >> member[i].Hot;
}
std::cin >> m;
mentai = new Mentai[m];
bought = new int[m];
for(int i = 0; i < m; i++)
{
std::cin >> mentai[i].Price >> mentai[i].Hot;
bought[i] = 0;
}
int max = 0;
for(int i = 0; i < n; i++)
{
for(int j = 0; j < m; j++)
{
if((member[i].Price <= mentai[j].Price) && (member[i].Hot >= mentai[j].Hot))
{
bought[j]++;
if(bought[j] > max)
{
max = bought[j];
}
}
}
}
if(max == 0)
{
std::cout << "0" << std::endl;
}
else
{
for(int i = 0; i < m; i++)
{
if(bought[i] == max)
std::cout << (i + 1) << std::endl;
}
}
return 0;
}
lunnear