# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
82565 |
2018-10-31T13:24:32 Z |
Leonardo_Paes |
San (COCI17_san) |
C++11 |
|
81 ms |
516 KB |
#include <bits/stdc++.h>
using namespace std;
#define MAXN 25
int h[MAXN], g[MAXN];
int main(){
int n;
long long s;
cin >> n >> s;
for(int i=1; i<=n; i++){
cin >> h[i] >> g[i];
}
long long ans=0;
for(int i=0; i<(1<<n); i++){
int u = i;
int ant=0;
bool ok=1;
long long sum = 0;
for(int j=1; j<=20; j++){
if(u%2==1){
if(h[j]>=h[ant]){
sum+=g[j];
ant=j;
}
else{
ok=0;
break;
}
}
u = u/2;
}
if(ok==1){
if(sum>=s){
ans++;
}
}
}
cout << ans << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
380 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
81 ms |
432 KB |
Output is correct |
2 |
Correct |
16 ms |
464 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
516 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
516 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
516 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |