# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
83445 | 2018-11-07T16:53:26 Z | tincamatei | Worst Reporter 3 (JOI18_worst_reporter3) | C++14 | 1392 ms | 88868 KB |
#include <bits/stdc++.h> using namespace std; const int MAX_N = 500000; long long d[1+MAX_N]; long long per[1+MAX_N], jump[1+MAX_N]; long long 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; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1254 ms | 16380 KB | Output is correct |
2 | Correct | 1265 ms | 16568 KB | Output is correct |
3 | Correct | 1291 ms | 16568 KB | Output is correct |
4 | Correct | 1266 ms | 16568 KB | Output is correct |
5 | Correct | 1277 ms | 16568 KB | Output is correct |
6 | Correct | 1307 ms | 17792 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 17792 KB | Output is correct |
2 | Correct | 3 ms | 17792 KB | Output is correct |
3 | Correct | 3 ms | 17792 KB | Output is correct |
4 | Correct | 3 ms | 17792 KB | Output is correct |
5 | Correct | 3 ms | 17792 KB | Output is correct |
6 | Correct | 3 ms | 17792 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1254 ms | 16380 KB | Output is correct |
2 | Correct | 1265 ms | 16568 KB | Output is correct |
3 | Correct | 1291 ms | 16568 KB | Output is correct |
4 | Correct | 1266 ms | 16568 KB | Output is correct |
5 | Correct | 1277 ms | 16568 KB | Output is correct |
6 | Correct | 1307 ms | 17792 KB | Output is correct |
7 | Correct | 3 ms | 17792 KB | Output is correct |
8 | Correct | 3 ms | 17792 KB | Output is correct |
9 | Correct | 3 ms | 17792 KB | Output is correct |
10 | Correct | 3 ms | 17792 KB | Output is correct |
11 | Correct | 3 ms | 17792 KB | Output is correct |
12 | Correct | 3 ms | 17792 KB | Output is correct |
13 | Correct | 882 ms | 17792 KB | Output is correct |
14 | Correct | 828 ms | 17792 KB | Output is correct |
15 | Correct | 809 ms | 17792 KB | Output is correct |
16 | Correct | 850 ms | 17792 KB | Output is correct |
17 | Correct | 1002 ms | 17792 KB | Output is correct |
18 | Correct | 1034 ms | 20528 KB | Output is correct |
19 | Correct | 1008 ms | 20528 KB | Output is correct |
20 | Correct | 1010 ms | 26776 KB | Output is correct |
21 | Correct | 1029 ms | 45472 KB | Output is correct |
22 | Correct | 1010 ms | 63888 KB | Output is correct |
23 | Correct | 1044 ms | 64092 KB | Output is correct |
24 | Correct | 1016 ms | 64092 KB | Output is correct |
25 | Correct | 1392 ms | 64600 KB | Output is correct |
26 | Correct | 1282 ms | 64600 KB | Output is correct |
27 | Correct | 1083 ms | 64604 KB | Output is correct |
28 | Correct | 1114 ms | 64604 KB | Output is correct |
29 | Correct | 1063 ms | 75364 KB | Output is correct |
30 | Correct | 1155 ms | 75408 KB | Output is correct |
31 | Correct | 1179 ms | 83496 KB | Output is correct |
32 | Correct | 1119 ms | 88868 KB | Output is correct |
33 | Correct | 3 ms | 88868 KB | Output is correct |