Submission #955786

#TimeUsernameProblemLanguageResultExecution timeMemory
955786vjudge1Pinball (JOI14_pinball)C++17
11 / 100
1029 ms348 KiB
#include <bits/stdc++.h> using namespace std; long long n,m,cena=10e9; long long a[2000],b[2000],c[2000],d[2000]; long long rek(long long l,long long r,long long rez,int i){ if(l<=1 && r>=n) return rez; else if(i==-1) return 10e19; long long rez1=10e19,rez2=10e19; rez1=rek(l,r,rez,i-1); if(c[i]<=r && c[i]>=l){ if(l==0 || r==0) rez2=rek(a[i],b[i],rez+d[i],i-1); else rez2=rek(min(a[i],l),max(b[i],r),rez+d[i],i-1); } else if(l==0) rez2=rek(a[i],b[i],rez+d[i],i-1); return min(rez1,rez2); } int main() { cin>>m>>n; long long l=0,r=0,rez=0; for(int i=0;i<m;i++) cin>>a[i]>>b[i]>>c[i]>>d[i]; long long k=rek(0,0,0,m-1); if(k==9223372036854775807) cout<<-1; else cout<<k; return 0; }

Compilation message (stderr)

pinball.cpp: In function 'long long int rek(long long int, long long int, long long int, int)':
pinball.cpp:10:28: warning: overflow in conversion from 'double' to 'long long int' changes value from '1.0e+20' to '9223372036854775807' [-Woverflow]
   10 |      else if(i==-1) return 10e19;
      |                            ^~~~~
pinball.cpp:12:24: warning: overflow in conversion from 'double' to 'long long int' changes value from '1.0e+20' to '9223372036854775807' [-Woverflow]
   12 |         long long rez1=10e19,rez2=10e19;
      |                        ^~~~~
pinball.cpp:12:35: warning: overflow in conversion from 'double' to 'long long int' changes value from '1.0e+20' to '9223372036854775807' [-Woverflow]
   12 |         long long rez1=10e19,rez2=10e19;
      |                                   ^~~~~
pinball.cpp: In function 'int main()':
pinball.cpp:29:15: warning: unused variable 'l' [-Wunused-variable]
   29 |     long long l=0,r=0,rez=0;
      |               ^
pinball.cpp:29:19: warning: unused variable 'r' [-Wunused-variable]
   29 |     long long l=0,r=0,rez=0;
      |                   ^
pinball.cpp:29:23: warning: unused variable 'rez' [-Wunused-variable]
   29 |     long long l=0,r=0,rez=0;
      |                       ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...