| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 47444 | Just_Solve_The_Problem | Worst Reporter 3 (JOI18_worst_reporter3) | C++11 | 374 ms | 10104 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define ll long long
#define pii pair < int, int >
#define fr first
#define sc second
#define mk make_pair
#define sz(s) (int)s.size()
#define all(s) s.begin(), s.end()
#define ok puts("ok");
#define whatis(x) cerr << #x << " = " << x << endl;
#define pause system("pause");
#define random rand() ^ (rand() << 5)
const int N = (int)5e5 + 7;
const int inf = (int)1e9 + 7;
int n, q;
int d[N];
pii ar[N];
ll pos[N];
bool fl = 1;
main() {
scanf("%d %d", &n, &q);
ar[0] = {1, 1};
for (int i = 1; i <= n; i++) {
scanf("%d", &d[i]);
ar[i].sc = (d[i] + ar[i - 1].sc - 1) / ar[i - 1].sc * ar[i - 1].fr;
ar[i].fr = (ar[i].sc / ar[i - 1].fr * ar[i - 1].sc + (-(i - 1))) - 1 - (-i);
}
for (int i = 1; i <= n; i++) {
fl &= (d[i] == 1);
}
if (fl) {
while (q--) {
int t, l, r;
scanf("%d %d %d", &t, &l, &r);
int tl = -n + t;
int tr = t;
int ans = 0;
if (tr >= l) {
ans = tr - l + 1;
} else if (tl <= r) {
ans = r - tl + 1;
}
printf("%d\n", ans);
}
return 0;
}
while (q--) {
int t, l, r;
scanf("%d %d %d", &t, &l, &r);
for (int i = 0; i <= n; i++) {
pos[i] = t / ar[i].sc * ar[i].fr + (-i);
}
int ans = 0;
for (int i = 0; i <= n; i++) {
if (pos[i] >= l && pos[i] <= r) {
ans++;
}
}
printf("%d\n", ans);
}
}
컴파일 시 표준 에러 (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... | ||||
