# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
122042 | 2019-06-27T12:28:05 Z | KLPP | Bitaro, who Leaps through Time (JOI19_timeleap) | C++14 | 3000 ms | 11180 KB |
#include<bits/stdc++.h> using namespace std; typedef long long int lld; typedef pair<lld,lld> pii; #define rep(i,a,b) for(int i=a;i<b;i++) #define trav(a,v) for(auto a:v) pii roads[1000000]; int main(){ int n,q; scanf("%d %d",&n,&q); rep(i,0,n-1){ scanf("%lld %lld",&roads[i].first,&roads[i].second); } while(q--){ int t; scanf("%d",&t); if(t==1){ int index; scanf("%d",&index); index--; scanf("%lld %lld",&roads[index].first,&roads[index].second); }else{ int a,c; lld b,d; scanf("%d %lld %d %lld",&a,&b,&c,&d); a--;c--; if(a<=c){ lld time=b; lld cost=0; while(a<c){ //cout<<time<<endl; cost+=max((lld)0,time-(roads[a].second-1)); //cout<<cost<<"A"<<endl; time=max(time,roads[a].first); time++; time=min(time,roads[a].second); a++; } //cout<<d<<endl; cost+=max((lld)0,time-d); printf("%lld\n",cost); } else{ lld time=b; lld cost=0; while(c<a){ //cout<<"T"<<time<<" "<<cost<<endl; cost+=max((lld)0,time-(roads[a-1].second-1)); time=max(time,roads[a-1].first); time++; time=min(time,roads[a-1].second); a--; } cost+=max((lld)0,time-d); printf("%lld\n",cost); } } } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
8 | Correct | 2 ms | 256 KB | Output is correct |
9 | Correct | 2 ms | 384 KB | Output is correct |
10 | Correct | 2 ms | 384 KB | Output is correct |
11 | Correct | 3 ms | 384 KB | Output is correct |
12 | Correct | 3 ms | 384 KB | Output is correct |
13 | Correct | 3 ms | 384 KB | Output is correct |
14 | Correct | 3 ms | 384 KB | Output is correct |
15 | Correct | 3 ms | 384 KB | Output is correct |
16 | Correct | 3 ms | 384 KB | Output is correct |
17 | Correct | 3 ms | 384 KB | Output is correct |
18 | Correct | 3 ms | 384 KB | Output is correct |
19 | Correct | 3 ms | 400 KB | Output is correct |
20 | Correct | 3 ms | 384 KB | Output is correct |
21 | Correct | 3 ms | 384 KB | Output is correct |
22 | Correct | 3 ms | 384 KB | Output is correct |
23 | Correct | 3 ms | 384 KB | Output is correct |
24 | Correct | 3 ms | 384 KB | Output is correct |
25 | Correct | 3 ms | 384 KB | Output is correct |
26 | Correct | 4 ms | 384 KB | Output is correct |
27 | Correct | 4 ms | 384 KB | Output is correct |
28 | Correct | 4 ms | 384 KB | Output is correct |
29 | Correct | 3 ms | 384 KB | Output is correct |
30 | Correct | 3 ms | 384 KB | Output is correct |
31 | Correct | 3 ms | 384 KB | Output is correct |
32 | Correct | 3 ms | 384 KB | Output is correct |
33 | Correct | 3 ms | 384 KB | Output is correct |
34 | Correct | 3 ms | 384 KB | Output is correct |
35 | Correct | 3 ms | 384 KB | Output is correct |
36 | Correct | 3 ms | 384 KB | Output is correct |
37 | Correct | 3 ms | 384 KB | Output is correct |
38 | Correct | 3 ms | 384 KB | Output is correct |
39 | Correct | 3 ms | 384 KB | Output is correct |
40 | Correct | 4 ms | 356 KB | Output is correct |
41 | Correct | 2 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3019 ms | 11180 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
8 | Correct | 2 ms | 256 KB | Output is correct |
9 | Correct | 2 ms | 384 KB | Output is correct |
10 | Correct | 2 ms | 384 KB | Output is correct |
11 | Correct | 3 ms | 384 KB | Output is correct |
12 | Correct | 3 ms | 384 KB | Output is correct |
13 | Correct | 3 ms | 384 KB | Output is correct |
14 | Correct | 3 ms | 384 KB | Output is correct |
15 | Correct | 3 ms | 384 KB | Output is correct |
16 | Correct | 3 ms | 384 KB | Output is correct |
17 | Correct | 3 ms | 384 KB | Output is correct |
18 | Correct | 3 ms | 384 KB | Output is correct |
19 | Correct | 3 ms | 400 KB | Output is correct |
20 | Correct | 3 ms | 384 KB | Output is correct |
21 | Correct | 3 ms | 384 KB | Output is correct |
22 | Correct | 3 ms | 384 KB | Output is correct |
23 | Correct | 3 ms | 384 KB | Output is correct |
24 | Correct | 3 ms | 384 KB | Output is correct |
25 | Correct | 3 ms | 384 KB | Output is correct |
26 | Correct | 4 ms | 384 KB | Output is correct |
27 | Correct | 4 ms | 384 KB | Output is correct |
28 | Correct | 4 ms | 384 KB | Output is correct |
29 | Correct | 3 ms | 384 KB | Output is correct |
30 | Correct | 3 ms | 384 KB | Output is correct |
31 | Correct | 3 ms | 384 KB | Output is correct |
32 | Correct | 3 ms | 384 KB | Output is correct |
33 | Correct | 3 ms | 384 KB | Output is correct |
34 | Correct | 3 ms | 384 KB | Output is correct |
35 | Correct | 3 ms | 384 KB | Output is correct |
36 | Correct | 3 ms | 384 KB | Output is correct |
37 | Correct | 3 ms | 384 KB | Output is correct |
38 | Correct | 3 ms | 384 KB | Output is correct |
39 | Correct | 3 ms | 384 KB | Output is correct |
40 | Correct | 4 ms | 356 KB | Output is correct |
41 | Correct | 2 ms | 256 KB | Output is correct |
42 | Execution timed out | 3019 ms | 11180 KB | Time limit exceeded |
43 | Halted | 0 ms | 0 KB | - |