# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
955768 | 2024-03-31T12:01:08 Z | vjudge1 | Pinball (JOI14_pinball) | C++14 | 1000 ms | 47188 KB |
#include <bits/stdc++.h> using namespace std; int main() { long long n,m; cin>>m>>n; long long a[m+1],b[m+1],c[m+1],d[m+1]; set<long long> s; for(long long i=0; i<m; i++) { cin>>a[i]>>b[i]>>c[i]>>d[i]; a[i]--;b[i]--;c[i]--; for(long long k=a[i]; k<=b[i]; k++)s.insert(k); } if(s.size()!=n) { cout<<-1<<endl; return 0; } long long res=1e18; long long last[n+1]; for(long long mask=0; mask<(1<<m); mask++) { long long cena=0; memset(last,-1,sizeof(last)); for(long long i=0; i<m; i++) { if(mask&(1<<i)) { for(long long k=a[i]; k<=b[i]; k++)last[k]=0; last[c[i]]=-1; cena+=d[i]; } } long long cnt=0; for(long long i=0; i<n; i++) { if(last[i]==-1)cnt++; } if(cnt==1)res=min(res,cena); } if(res==INT_MAX)res=-1; cout<<res<<endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 344 KB | Output is correct |
5 | Correct | 1 ms | 360 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 344 KB | Output is correct |
5 | Correct | 1 ms | 360 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Execution timed out | 1070 ms | 47188 KB | Time limit exceeded |
10 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 344 KB | Output is correct |
5 | Correct | 1 ms | 360 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Execution timed out | 1070 ms | 47188 KB | Time limit exceeded |
10 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 344 KB | Output is correct |
5 | Correct | 1 ms | 360 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Execution timed out | 1070 ms | 47188 KB | Time limit exceeded |
10 | Halted | 0 ms | 0 KB | - |