# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
132839 | 2019-07-19T18:03:08 Z | duality | Worst Reporter 3 (JOI18_worst_reporter3) | C++11 | 522 ms | 25664 KB |
#include <bits/stdc++.h> using namespace std; #define mp make_pair #define pb push_back typedef long long int LLI; typedef pair<int,int> pii; typedef vector<int> vi; typedef vector<pii> vpii; int D[500000],p[500001]; struct group { int s,e,p; }; vector<group> groups; int main() { int i; int N,Q; scanf("%d %d",&N,&Q); for (i = 0; i < N; i++) scanf("%d",&D[i]); p[0] = 1; for (i = 0; i < N; i++) { int x = (D[i]+p[i]-1)/p[i]; p[i+1] = p[i]*x; if (p[i+1] > 1.1e9) p[i+1] = 1.1e9; } for (i = 0; i <= N; i++) { if ((i == 0) || (p[i] != p[i-1])) groups.pb((group){-i,-i,p[i]}); else groups.back().s = -i; } int j,T,L,R; for (i = 0; i < Q; i++) { scanf("%d %d %d",&T,&L,&R); int ans = 0; for (j = 0; j < groups.size(); j++) { int x = (T/groups[j].p)*groups[j].p; int s = max(groups[j].s+x,L),e = min(groups[j].e+x,R); if (s <= e) ans += e-s+1; } printf("%d\n",ans); } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 383 ms | 22792 KB | Output is correct |
2 | Correct | 379 ms | 22776 KB | Output is correct |
3 | Correct | 380 ms | 22652 KB | Output is correct |
4 | Correct | 380 ms | 22776 KB | Output is correct |
5 | Correct | 378 ms | 22672 KB | Output is correct |
6 | Correct | 378 ms | 22732 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 376 KB | Output is correct |
4 | Correct | 3 ms | 376 KB | Output is correct |
5 | Correct | 3 ms | 504 KB | Output is correct |
6 | Correct | 3 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 383 ms | 22792 KB | Output is correct |
2 | Correct | 379 ms | 22776 KB | Output is correct |
3 | Correct | 380 ms | 22652 KB | Output is correct |
4 | Correct | 380 ms | 22776 KB | Output is correct |
5 | Correct | 378 ms | 22672 KB | Output is correct |
6 | Correct | 378 ms | 22732 KB | Output is correct |
7 | Correct | 3 ms | 376 KB | Output is correct |
8 | Correct | 3 ms | 376 KB | Output is correct |
9 | Correct | 3 ms | 376 KB | Output is correct |
10 | Correct | 3 ms | 376 KB | Output is correct |
11 | Correct | 3 ms | 504 KB | Output is correct |
12 | Correct | 3 ms | 376 KB | Output is correct |
13 | Correct | 395 ms | 21180 KB | Output is correct |
14 | Correct | 410 ms | 21792 KB | Output is correct |
15 | Correct | 380 ms | 20600 KB | Output is correct |
16 | Correct | 396 ms | 21040 KB | Output is correct |
17 | Correct | 481 ms | 25356 KB | Output is correct |
18 | Correct | 478 ms | 25336 KB | Output is correct |
19 | Correct | 484 ms | 25464 KB | Output is correct |
20 | Correct | 487 ms | 25260 KB | Output is correct |
21 | Correct | 483 ms | 25444 KB | Output is correct |
22 | Correct | 485 ms | 25664 KB | Output is correct |
23 | Correct | 487 ms | 25260 KB | Output is correct |
24 | Correct | 477 ms | 25336 KB | Output is correct |
25 | Correct | 389 ms | 22648 KB | Output is correct |
26 | Correct | 403 ms | 22648 KB | Output is correct |
27 | Correct | 495 ms | 24984 KB | Output is correct |
28 | Correct | 497 ms | 25208 KB | Output is correct |
29 | Correct | 488 ms | 24612 KB | Output is correct |
30 | Correct | 522 ms | 24824 KB | Output is correct |
31 | Correct | 493 ms | 25020 KB | Output is correct |
32 | Correct | 364 ms | 21320 KB | Output is correct |
33 | Correct | 2 ms | 252 KB | Output is correct |