# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1110239 | vjudge1 | Escape Route 2 (JOI24_escape2) | C++17 | 339 ms | 7008 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
int n;
long long t;
long long a[2010],b[2010];
int q;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
if(fopen("c.INP","r")){
freopen("c.INP","r",stdin);
freopen("c.OUT","w",stdout);
}
cin >>n>>t;
for(int i=1;i<n;i++){
int x;
cin >>x>>a[i]>>b[i];
}
cin >>q;
while(q--){
int s,e;
cin >>s>>e;
long long asw=-a[s];
long long cr=0;
for(int i=s;i<e;i++){
if(cr>a[i]){
asw=asw+t-cr;
cr=0;
}
asw=asw+b[i]-cr;
cr=b[i];
}
cout <<asw<<'\n';
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |