# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
704018 |
2023-03-01T11:24:59 Z |
vjudge1 |
Bank (IZhO14_bank) |
C++17 |
|
1000 ms |
6732 KB |
// Problem: Elevator Rides
#include <bits/stdc++.h>
using namespace std ;
#define ff first
#define ss second
#define ll long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define ones(x) __builtin_popcount(x)
#define remove(v) v.erase(unique(all(v)), v.end())
#define rep(i, a, b) for(int i = a; i <= b; i++)
#define per(i, a, b) for(int i = a; i >= b; i--)
#ifdef local
#include "C:\debug.h"
#else
#define dbg(x...) 42
#endif
const int N = 2e6 + 2 ;
int n , m , a[21] , b[21] ;
vector<int> f[1001] ;
void go(int i , int mask) {
if(i > n) {
cout << "YES\n" ;
exit(0) ;
}
for(auto& x : f[a[i]]) {
bool ok = 1 ;
rep(i , 0 , 32) {
if((mask >> i & 1) == 1 && (x >> i & 1) == 1) {
ok = 0 ;
break ;
}
}
if(ok) {
go(i + 1 , (mask | x)) ;
}
}
}
void solve(){
cin >> n >> m ;
rep(i , 1 , n) cin >> a[i] ;
rep(i , 1 , m) cin >> b[i] ;
rep(i , 1 , (1 << m) - 1) {
int cur = 0 ;
rep(mask , 0 , m - 1) {
if((i >> mask) & 1) {
cur += b[mask + 1] ;
}
}
if(cur <= 1000) {
f[cur].pb(i) ;
}
}
go(1 , 0) ;
cout << "NO" ;
}
int main () {
ios::sync_with_stdio(false) ;
cin.tie(0) ;
int test = 1 ;
// cin >> test ;
for(int i = 1 ; i <= test ; i++) {
solve() ;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
3 ms |
468 KB |
Output is correct |
5 |
Correct |
70 ms |
6732 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
66 ms |
5908 KB |
Output is correct |
9 |
Correct |
66 ms |
6344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
0 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
2 ms |
468 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
2 ms |
340 KB |
Output is correct |
8 |
Correct |
2 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
2 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
3 ms |
468 KB |
Output is correct |
5 |
Correct |
70 ms |
6732 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
66 ms |
5908 KB |
Output is correct |
9 |
Correct |
66 ms |
6344 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
0 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
0 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
0 ms |
340 KB |
Output is correct |
19 |
Correct |
0 ms |
340 KB |
Output is correct |
20 |
Correct |
1 ms |
340 KB |
Output is correct |
21 |
Correct |
1 ms |
340 KB |
Output is correct |
22 |
Correct |
1 ms |
340 KB |
Output is correct |
23 |
Correct |
1 ms |
340 KB |
Output is correct |
24 |
Correct |
2 ms |
468 KB |
Output is correct |
25 |
Correct |
1 ms |
340 KB |
Output is correct |
26 |
Correct |
2 ms |
340 KB |
Output is correct |
27 |
Correct |
2 ms |
340 KB |
Output is correct |
28 |
Correct |
1 ms |
340 KB |
Output is correct |
29 |
Correct |
1 ms |
340 KB |
Output is correct |
30 |
Correct |
2 ms |
340 KB |
Output is correct |
31 |
Correct |
70 ms |
5644 KB |
Output is correct |
32 |
Correct |
66 ms |
6004 KB |
Output is correct |
33 |
Correct |
63 ms |
1024 KB |
Output is correct |
34 |
Correct |
62 ms |
340 KB |
Output is correct |
35 |
Correct |
61 ms |
352 KB |
Output is correct |
36 |
Correct |
63 ms |
340 KB |
Output is correct |
37 |
Correct |
69 ms |
464 KB |
Output is correct |
38 |
Correct |
64 ms |
424 KB |
Output is correct |
39 |
Correct |
66 ms |
5164 KB |
Output is correct |
40 |
Correct |
74 ms |
1956 KB |
Output is correct |
41 |
Correct |
62 ms |
856 KB |
Output is correct |
42 |
Execution timed out |
1081 ms |
5748 KB |
Time limit exceeded |
43 |
Halted |
0 ms |
0 KB |
- |