Submission #955771

#TimeUsernameProblemLanguageResultExecution timeMemory
955771vjudge1Pinball (JOI14_pinball)C++17
0 / 100
1 ms348 KiB
#include <bits/stdc++.h>

using namespace std;
int n,m,cena=10e9;
int a[2000],b[2000],c[2000],d[2000];

int rek(int l,int r,int rez,int i){
     if(l<=1 && r>=n)
        return rez;
     else if(i==-1) return 10e9;

        int rez1=10e9,rez2=10e9;
        rez1=rek(l,r,rez,i-1);
        if(c[i]<=r && c[i]>=l){
            if(l==r)
            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(i==m-1)
        rez2=rek(a[i],b[i],rez+d[i],i-1);

        return min(rez1,rez2);
     }

int main()
{

    cin>>m>>n;
    int 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==INT_MAX) cout<<-1;
    else cout<<k;
    return 0;
}

Compilation message (stderr)

pinball.cpp:4:14: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+10' to '2147483647' [-Woverflow]
    4 | int n,m,cena=10e9;
      |              ^~~~
pinball.cpp: In function 'int rek(int, int, int, int)':
pinball.cpp:10:28: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+10' to '2147483647' [-Woverflow]
   10 |      else if(i==-1) return 10e9;
      |                            ^~~~
pinball.cpp:12:18: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+10' to '2147483647' [-Woverflow]
   12 |         int rez1=10e9,rez2=10e9;
      |                  ^~~~
pinball.cpp:12:28: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+10' to '2147483647' [-Woverflow]
   12 |         int rez1=10e9,rez2=10e9;
      |                            ^~~~
pinball.cpp: In function 'int main()':
pinball.cpp:30:9: warning: unused variable 'l' [-Wunused-variable]
   30 |     int l=0,r=0,rez=0;
      |         ^
pinball.cpp:30:13: warning: unused variable 'r' [-Wunused-variable]
   30 |     int l=0,r=0,rez=0;
      |             ^
pinball.cpp:30:17: warning: unused variable 'rez' [-Wunused-variable]
   30 |     int 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...