# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
967703 | duckindog | Boat (APIO16_boat) | C++17 | 450 ms | 524288 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int N = 500 + 10,
M = 1'000'000'000 + 7;
int n;
int a[N], b[N];
int f[N][1'000'000 + 10];
int32_t main() {
cin.tie(0)->sync_with_stdio(0);
cin >> n;
for (int i = 1; i <= n; ++i) cin >> a[i] >> b[i];
vector<int> rrh;
for (int i = 1; i <= n; ++i) {
for (int j = a[i]; j <= b[i]; ++j) rrh.push_back(j);
}
sort(rrh.begin(), rrh.end());
rrh.resize(unique(rrh.begin(), rrh.end()) - rrh.begin());
for (int i = 0; i <= n; ++i) f[i][0] = 1;
for (int i = 1; i <= n; ++i) {
int it = lower_bound(rrh.begin(), rrh.end(), a[i]) - rrh.begin() + 1;
for (int j = it; j <= b[i] - a[i] + it; ++j) f[i][j] = f[i - 1][j - 1];
for (int j = it; j <= rrh.size(); ++j) f[i][j] = (f[i][j] + f[i][j - 1]) % M;
}
cout << f[n][rrh.size()] << "\n";
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |