結果
| 問題 |
No.647 明太子
|
| コンテスト | |
| ユーザー |
かぼちゃ
|
| 提出日時 | 2018-03-03 18:53:42 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 41 ms / 4,500 ms |
| コード長 | 826 bytes |
| コンパイル時間 | 660 ms |
| コンパイル使用メモリ | 68,812 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-27 02:48:26 |
| 合計ジャッジ時間 | 1,534 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> A(n);
vector<int> B(n);
for(int i = 0;i < n;i++){
cin >> A[i] >> B[i];
}
int m;
cin >> m;
int x,y;
vector<int> ans(m);
int max=0;
string anss;
for(int i = 0;i < m;i++){
cin >> x >> y;
for(int j = 0;j < n;j++){
if(x <= A[j] && y >= B[j])ans[i]++;
} if(ans[i] > max){
max = ans[i];
anss = to_string(i+1) + "\n";
}
else if(ans[i] == 0 &&ans[i] == max)
anss = "0";
else if(ans[i] == max){
max = ans[i];
anss += to_string(i+1) + "\n";
}
}
cout << anss;
return 0;
}
かぼちゃ