| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 83444 | tincamatei | Worst Reporter 3 (JOI18_worst_reporter3) | C++14 | 1022 ms | 93692 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 500000;
int d[1+MAX_N];
int per[1+MAX_N], jump[1+MAX_N];
int poz(int i, int t) {
return -i + t / per[i] * jump[i];
}
int binsrc(int n, int t, int val) {
int st = -1, dr = n + 1;
while(dr - st > 1) {
int mid = (st + dr) / 2;
if(poz(mid, t) <= val)
dr = mid;
else
st = mid;
}
return dr;
}
int main() {
#ifdef HOME
FILE *fin = fopen("input.in", "r");
FILE *fout = fopen("output.out", "w");
#else
FILE *fin = stdin;
FILE *fout = stdout;
#endif
int n, q, t, l, r;
fscanf(fin, "%d%d", &n, &q);
per[0] = jump[0] = 1;
for(int i = 1; i <= n; ++i) {
fscanf(fin, "%d", &d[i]);
per[i] = (d[i] + jump[i - 1] - 1) / jump[i - 1];
jump[i] = jump[i - 1] * per[i];
per[i] = per[i - 1] * per[i];
}
for(int i = 0; i < q; ++i) {
fscanf(fin, "%d%d%d", &t, &l, &r);
int a = binsrc(n, t, r), b = binsrc(n, t, l - 1);
fprintf(fout, "%d\n", b - a);
}
#ifdef HOME
fclose(fin);
fclose(fout);
#endif
return 0;
}
컴파일 시 표준 에러 (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... | ||||
