# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
43968 | 2018-03-29T01:19:24 Z | model_code | Worst Reporter 3 (JOI18_worst_reporter3) | C++17 | 618 ms | 3672 KB |
#include<stdio.h> #include<vector> #include<algorithm> using namespace std; typedef long long ll; typedef pair<ll, ll>pii; typedef pair<ll, pii>pi3; int main() { int num, query; scanf("%d%d", &num, &query); ll dif = 1; int beg = 0; vector<pi3>v; for (int i = 1; i <= num; i++) { ll z; scanf("%lld", &z); if (z > dif) { v.push_back(make_pair(dif, make_pair(beg, i - 1))); dif = (z + dif - 1) / dif*dif; beg = i; } } v.push_back(make_pair(dif, make_pair(beg, num))); for (int p = 0; p < query; p++) { ll zt, zl, zr; scanf("%lld%lld%lld", &zt, &zl, &zr); ll ans = 0; for (int i = 0; i < v.size(); i++) { ll end = zt / v[i].first*v[i].first - v[i].second.first; ll beg = end + v[i].second.first - v[i].second.second; ans += max(0LL, min(zr, end) - max(zl, beg) + 1); } printf("%lld\n", ans); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 386 ms | 3288 KB | Output is correct |
2 | Correct | 398 ms | 3672 KB | Output is correct |
3 | Correct | 364 ms | 3672 KB | Output is correct |
4 | Correct | 362 ms | 3672 KB | Output is correct |
5 | Correct | 367 ms | 3672 KB | Output is correct |
6 | Correct | 394 ms | 3672 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 3672 KB | Output is correct |
2 | Correct | 2 ms | 3672 KB | Output is correct |
3 | Correct | 2 ms | 3672 KB | Output is correct |
4 | Correct | 2 ms | 3672 KB | Output is correct |
5 | Correct | 2 ms | 3672 KB | Output is correct |
6 | Correct | 2 ms | 3672 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 386 ms | 3288 KB | Output is correct |
2 | Correct | 398 ms | 3672 KB | Output is correct |
3 | Correct | 364 ms | 3672 KB | Output is correct |
4 | Correct | 362 ms | 3672 KB | Output is correct |
5 | Correct | 367 ms | 3672 KB | Output is correct |
6 | Correct | 394 ms | 3672 KB | Output is correct |
7 | Correct | 3 ms | 3672 KB | Output is correct |
8 | Correct | 2 ms | 3672 KB | Output is correct |
9 | Correct | 2 ms | 3672 KB | Output is correct |
10 | Correct | 2 ms | 3672 KB | Output is correct |
11 | Correct | 2 ms | 3672 KB | Output is correct |
12 | Correct | 2 ms | 3672 KB | Output is correct |
13 | Correct | 392 ms | 3672 KB | Output is correct |
14 | Correct | 416 ms | 3672 KB | Output is correct |
15 | Correct | 384 ms | 3672 KB | Output is correct |
16 | Correct | 387 ms | 3672 KB | Output is correct |
17 | Correct | 563 ms | 3672 KB | Output is correct |
18 | Correct | 618 ms | 3672 KB | Output is correct |
19 | Correct | 566 ms | 3672 KB | Output is correct |
20 | Correct | 597 ms | 3672 KB | Output is correct |
21 | Correct | 524 ms | 3672 KB | Output is correct |
22 | Correct | 559 ms | 3672 KB | Output is correct |
23 | Correct | 549 ms | 3672 KB | Output is correct |
24 | Correct | 539 ms | 3672 KB | Output is correct |
25 | Correct | 374 ms | 3672 KB | Output is correct |
26 | Correct | 370 ms | 3672 KB | Output is correct |
27 | Correct | 536 ms | 3672 KB | Output is correct |
28 | Correct | 572 ms | 3672 KB | Output is correct |
29 | Correct | 580 ms | 3672 KB | Output is correct |
30 | Correct | 584 ms | 3672 KB | Output is correct |
31 | Correct | 602 ms | 3672 KB | Output is correct |
32 | Correct | 353 ms | 3672 KB | Output is correct |
33 | Correct | 2 ms | 3672 KB | Output is correct |