Submission #955781

#TimeUsernameProblemLanguageResultExecution timeMemory
955781vjudge1Pinball (JOI14_pinball)C++17
0 / 100
1 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]; int 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; int 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]; int k=rek(0,0,0,m-1); if(k==10e19) cout<<-1; else cout<<k; return 0; }

Compilation message (stderr)

pinball.cpp: In function 'int rek(long long int, long long int, long long int, int)':
pinball.cpp:10:28: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+20' to '2147483647' [-Woverflow]
   10 |      else if(i==-1) return 10e19;
      |                            ^~~~~
pinball.cpp:12:18: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+20' to '2147483647' [-Woverflow]
   12 |         int rez1=10e19,rez2=10e19;
      |                  ^~~~~
pinball.cpp:12:29: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+20' to '2147483647' [-Woverflow]
   12 |         int 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...