結果

問題 No.647 明太子
ユーザー stderrstderr
提出日時 2018-02-09 23:11:59
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 46 ms / 4,500 ms
コード長 1,112 bytes
コンパイル時間 464 ms
コンパイル使用メモリ 61,412 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-27 02:34:48
合計ジャッジ時間 1,427 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repR(i, n) for(int i = (n) - 1; i > -1; i--)
#define rep1(i, n) for(int i = 1; i < (int)(n + 1); i++)
#define rep1R(i, n) for(int i = (n); i > 0; i--)
#define ll long long
using namespace std;
const int N_MAX = 10000;
const int M_MAX = 1000;
int A[N_MAX];
int B[N_MAX];
int X[M_MAX];
int Y[M_MAX];
int cnt[M_MAX] = {};
int main() {
int N;
cin >> N;
rep(i, N) {
cin >> A[i] >> B[i];
}
int M;
cin >> M;
rep(i, M) {
cin >> X[i] >> Y[i];
}
bool flag = false;
rep(i, N) {
rep(j, M) {
if (A[i] >= X[j] && B[i] <= Y[j]) {
cnt[j]++;
flag = true;
}
}
}
if (!flag) {
cout << 0 << endl;
return 0;
}
// rep(i, M) cout << cnt[i] << " ";
// cout << endl;
int* it = max_element(cnt, cnt + M);
int maximum = *it;
cout << distance(cnt, it) + 1 << endl;
it = find(it + 1, cnt + M, maximum);
while (it != cnt + M) {
cout << distance(cnt, it) + 1 << endl;
it = find(it + 1, cnt + M, maximum);
}
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0