# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
293573 |
2020-09-08T08:11:48 Z |
phillip |
Pinball (JOI14_pinball) |
C++14 |
|
1000 ms |
384 KB |
#include <bits/stdc++.h>
#define ll long long
#define fast cin.tie(0);cout.tie(0);
#define order ios::sync_with_stdio(0);ios_base::sync_with_stdio(0);
#define pb push_back
using namespace std;
int n,m,a[200009],b[200009],c[200009];
ll d[200009],ans;
ll mxv=1e9;
ll bt(int x,int l,int r)
{
if(x==-1)
{
if(l==1&&r==n)return 0;
else return mxv;
}
ll ret=mxv;
ret=bt(x-1,l,r);
if(l<=c[x]&&c[x]<=r)ret=min(ret,d[x]+bt(x-1,min(l,a[x]),max(r,b[x])));
return ret;
}
int main()
{
mxv*=mxv;
cin>>m>>n;
for(int i=0;i<m;i++)cin>>a[i]>>b[i]>>c[i]>>d[i];
ans=mxv;
for(int i=0;i<n;i++)
{
ans=min(ans,bt(i-1,a[i],b[i])+d[i]);
}
if(ans==mxv)cout<<-1;
else cout<<ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
194 ms |
384 KB |
Output is correct |
3 |
Execution timed out |
1079 ms |
384 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
194 ms |
384 KB |
Output is correct |
3 |
Execution timed out |
1079 ms |
384 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
194 ms |
384 KB |
Output is correct |
3 |
Execution timed out |
1079 ms |
384 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
194 ms |
384 KB |
Output is correct |
3 |
Execution timed out |
1079 ms |
384 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |