Submission #1110239

#TimeUsernameProblemLanguageResultExecution timeMemory
1110239vjudge1Escape Route 2 (JOI24_escape2)C++17
6 / 100
339 ms7008 KiB
#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)

Main.cpp: In function 'int main()':
Main.cpp:12:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |         freopen("c.INP","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~
Main.cpp:13:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |         freopen("c.OUT","w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...