# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
171868 | 2019-12-30T14:12:27 Z | arnold518 | Worst Reporter 3 (JOI18_worst_reporter3) | C++14 | 606 ms | 39008 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 5e5; struct Query { ll t, l, r; }; int N, Q; ll D[MAXN+10]; Query A[MAXN+10]; int ans[MAXN+10]; int main() { int i, j; scanf("%d%d", &N, &Q); D[0]=1; for(i=1; i<=N; i++) scanf("%lld", &D[i]); for(i=1; i<=N; i++) D[i]=(D[i]+D[i-1]-1)/D[i-1]*D[i-1]; for(i=1; i<=Q; i++) scanf("%lld%lld%lld", &A[i].t, &A[i].l, &A[i].r); vector<ll> V; for(i=0; i<=N; i++) V.push_back(D[i]); V.erase(unique(V.begin(), V.end()), V.end()); for(auto it : V) { ll s, e; e=lower_bound(D, D+N+1, it)-D; s=upper_bound(D, D+N+1, it)-D-1; s*=-1; e*=-1; for(i=1; i<=Q; i++) { ll ss=s+A[i].t/it*it; ll ee=e+A[i].t/it*it; ans[i]+=max(0ll, min(ee, A[i].r)-max(ss, A[i].l)+1); } } for(i=1; i<=Q; i++) printf("%d\n", ans[i]); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 385 ms | 38784 KB | Output is correct |
2 | Correct | 384 ms | 37856 KB | Output is correct |
3 | Correct | 385 ms | 37948 KB | Output is correct |
4 | Correct | 384 ms | 37860 KB | Output is correct |
5 | Correct | 398 ms | 37852 KB | Output is correct |
6 | Correct | 385 ms | 37852 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 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 | 380 KB | Output is correct |
6 | Correct | 3 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 385 ms | 38784 KB | Output is correct |
2 | Correct | 384 ms | 37856 KB | Output is correct |
3 | Correct | 385 ms | 37948 KB | Output is correct |
4 | Correct | 384 ms | 37860 KB | Output is correct |
5 | Correct | 398 ms | 37852 KB | Output is correct |
6 | Correct | 385 ms | 37852 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 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 | 380 KB | Output is correct |
12 | Correct | 3 ms | 376 KB | Output is correct |
13 | Correct | 425 ms | 34616 KB | Output is correct |
14 | Correct | 427 ms | 34140 KB | Output is correct |
15 | Correct | 405 ms | 37184 KB | Output is correct |
16 | Correct | 411 ms | 35404 KB | Output is correct |
17 | Correct | 571 ms | 36316 KB | Output is correct |
18 | Correct | 567 ms | 36012 KB | Output is correct |
19 | Correct | 580 ms | 36060 KB | Output is correct |
20 | Correct | 572 ms | 35996 KB | Output is correct |
21 | Correct | 564 ms | 36032 KB | Output is correct |
22 | Correct | 565 ms | 36076 KB | Output is correct |
23 | Correct | 564 ms | 36060 KB | Output is correct |
24 | Correct | 584 ms | 36536 KB | Output is correct |
25 | Correct | 401 ms | 38868 KB | Output is correct |
26 | Correct | 395 ms | 38680 KB | Output is correct |
27 | Correct | 566 ms | 37144 KB | Output is correct |
28 | Correct | 601 ms | 36700 KB | Output is correct |
29 | Correct | 593 ms | 36700 KB | Output is correct |
30 | Correct | 602 ms | 36920 KB | Output is correct |
31 | Correct | 606 ms | 37100 KB | Output is correct |
32 | Correct | 376 ms | 39008 KB | Output is correct |
33 | Correct | 2 ms | 376 KB | Output is correct |