# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
101116 | 2019-03-16T17:05:34 Z | gs14004 | Worst Reporter 3 (JOI18_worst_reporter3) | C++17 | 717 ms | 19820 KB |
#include <bits/stdc++.h> using namespace std; const int MAXN = 500005; typedef long long lint; typedef pair<int, int> pi; const int mod = 1e9 + 7; int n, q, a[MAXN]; vector<pi> cnd; int main(){ scanf("%d %d",&n,&q); int prv = 1; a[0] = 1; for(int i=1; i<=n; i++){ scanf("%d",&a[i]); prv = ((a[i] - 1) / prv + 1) * prv; a[i] = prv; } for(int i=0; i<=n; ){ int e = i; while(e <= n && a[i] == a[e]) e++; cnd.push_back(pi(a[i], e - i)); i = e; } while(q--){ int l, r, t; scanf("%d %d %d",&t,&l,&r); int curp = t+1; int ans = 0, pos = 0; for(auto &i : cnd){ curp -= (curp + pos - 1) % i.first + 1; ans += max(0, min(r, curp) - max(l, curp - i.second + 1) + 1); curp -= i.second - 1; pos += i.second; } printf("%d\n", ans); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 403 ms | 18160 KB | Output is correct |
2 | Correct | 431 ms | 18176 KB | Output is correct |
3 | Correct | 377 ms | 18252 KB | Output is correct |
4 | Correct | 394 ms | 18324 KB | Output is correct |
5 | Correct | 362 ms | 18168 KB | Output is correct |
6 | Correct | 410 ms | 18312 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 3 ms | 356 KB | Output is correct |
3 | Correct | 3 ms | 256 KB | Output is correct |
4 | Correct | 3 ms | 256 KB | Output is correct |
5 | Correct | 3 ms | 256 KB | Output is correct |
6 | Correct | 3 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 403 ms | 18160 KB | Output is correct |
2 | Correct | 431 ms | 18176 KB | Output is correct |
3 | Correct | 377 ms | 18252 KB | Output is correct |
4 | Correct | 394 ms | 18324 KB | Output is correct |
5 | Correct | 362 ms | 18168 KB | Output is correct |
6 | Correct | 410 ms | 18312 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
8 | Correct | 3 ms | 356 KB | Output is correct |
9 | Correct | 3 ms | 256 KB | Output is correct |
10 | Correct | 3 ms | 256 KB | Output is correct |
11 | Correct | 3 ms | 256 KB | Output is correct |
12 | Correct | 3 ms | 384 KB | Output is correct |
13 | Correct | 417 ms | 17520 KB | Output is correct |
14 | Correct | 395 ms | 19320 KB | Output is correct |
15 | Correct | 368 ms | 17016 KB | Output is correct |
16 | Correct | 410 ms | 17504 KB | Output is correct |
17 | Correct | 513 ms | 4816 KB | Output is correct |
18 | Correct | 490 ms | 4820 KB | Output is correct |
19 | Correct | 519 ms | 4724 KB | Output is correct |
20 | Correct | 463 ms | 4780 KB | Output is correct |
21 | Correct | 464 ms | 4892 KB | Output is correct |
22 | Correct | 470 ms | 4828 KB | Output is correct |
23 | Correct | 517 ms | 4872 KB | Output is correct |
24 | Correct | 516 ms | 4800 KB | Output is correct |
25 | Correct | 388 ms | 19576 KB | Output is correct |
26 | Correct | 373 ms | 19820 KB | Output is correct |
27 | Correct | 539 ms | 5200 KB | Output is correct |
28 | Correct | 589 ms | 5188 KB | Output is correct |
29 | Correct | 576 ms | 5188 KB | Output is correct |
30 | Correct | 545 ms | 5268 KB | Output is correct |
31 | Correct | 717 ms | 5096 KB | Output is correct |
32 | Correct | 391 ms | 18808 KB | Output is correct |
33 | Correct | 2 ms | 256 KB | Output is correct |