# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
94840 |
2019-01-24T11:33:18 Z |
easrui |
Pinball (JOI14_pinball) |
C++14 |
|
4 ms |
504 KB |
#include <bits/stdc++.h>
using namespace std;
const int MaxM = 11;
const int MaxN = 1e3+5;
const long long INF = 1e15;
int M,N,sum;
long long ans=INF,cnt;
bool res[MaxN];
struct Pin{
int A,B,C,D;
}P[MaxM];
int main()
{
//freopen("input.txt","r",stdin);
ios_base::sync_with_stdio(0),cin.tie(0);
cin >> M >> N;
for(int i=0; i<M; i++) cin >> P[i].A >> P[i].B >> P[i].C >> P[i].D;
int sz = 1<<M;
for(int i=0; i<sz; i++){
fill(res,res+N+1,1);
cnt = 0;
for(int j=0; j<M; j++){
if(i&(1<<j)){
sum = 0;
cnt += P[j].D;
for(int k=P[j].A; k<=P[j].B; k++){
sum += res[k];
res[k] = 0;
}
if(sum) res[P[j].C] = 1;
}
}
sum=0;
for(int j=1; j<=N; j++) sum += res[j];
//if(i==31) cout << res[0] << '\n';
//cout << sum << ' ' << i << '\n';
if(sum==1) ans = min(ans,cnt);
}
if(ans == INF) cout << -1;
else cout << ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
3 ms |
376 KB |
Output is correct |
5 |
Correct |
3 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
4 ms |
376 KB |
Output is correct |
8 |
Correct |
4 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
3 ms |
376 KB |
Output is correct |
5 |
Correct |
3 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
4 ms |
376 KB |
Output is correct |
8 |
Correct |
4 ms |
376 KB |
Output is correct |
9 |
Runtime error |
2 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
3 ms |
376 KB |
Output is correct |
5 |
Correct |
3 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
4 ms |
376 KB |
Output is correct |
8 |
Correct |
4 ms |
376 KB |
Output is correct |
9 |
Runtime error |
2 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
3 ms |
376 KB |
Output is correct |
5 |
Correct |
3 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
4 ms |
376 KB |
Output is correct |
8 |
Correct |
4 ms |
376 KB |
Output is correct |
9 |
Runtime error |
2 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
10 |
Halted |
0 ms |
0 KB |
- |