# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
100489 |
2019-03-11T15:24:08 Z |
AbduM |
Bank (IZhO14_bank) |
C++14 |
|
1000 ms |
384 KB |
/// In the name of GOD
/// I love my MOTHER
/// Only GOLD
#include <bits/stdc++.h>
#define sz(s) (ll)(s.size())
#define all(x) (x.begin(), x.end())
#define pb push_back
#define pf push_front
#define F first
#define S second
#define mp make_pair
#define ort1 exit(0);
#define nl endl
#define rep(i, l, r) for(int i = (l); i <= (r); ++i)
#define per(i, l, r) for(int i = (l); i >= (r); --i)
#define TL clock() / (double)CLOCKS_PER_SEC
#define NFS ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
const double pi = acos(-1.0);
const double eps = 1e-9;
const long long inf = 1e12 + 1;
const long long INF = 1e18 + 1;
const int mod = 1e9 + 7;
const int N = 5e5 + 7;
int n, m;
int a[N];
int b[N];
int cnt;
bool bl[N];
inline void rec(int v = 1) {
if (v > m) {
rep(i, 1, n) {
if (a[i] > 0) return;
}
cout << "YES";
exit(0);
return;
}
rep(i, 1, n) {
if (a[i] >= b[v]) {
a[i] -= b[v];
rec(v + 1);
a[i] += b[v];
}
}
rec(v + 1);
}
int main(){
NFS
#ifdef ioi
freopen("in.txt", "r", stdin);
#else
//freopen("bank.in", "r", stdin);
//freopen("bank.out", "w", stdout);
#endif
cin >> n >> m;
rep(i, 1, n){
cin >> a[i];
}
rep(i, 1, m){
cin >> b[i];
}
rec();
cout << "NO";
ort1
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
3 ms |
384 KB |
Output is correct |
4 |
Correct |
3 ms |
384 KB |
Output is correct |
5 |
Correct |
3 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
2 ms |
384 KB |
Output is correct |
8 |
Correct |
2 ms |
384 KB |
Output is correct |
9 |
Correct |
10 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
3 ms |
384 KB |
Output is correct |
5 |
Correct |
3 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
2 ms |
384 KB |
Output is correct |
8 |
Correct |
11 ms |
384 KB |
Output is correct |
9 |
Correct |
3 ms |
384 KB |
Output is correct |
10 |
Correct |
6 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1053 ms |
384 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
3 ms |
384 KB |
Output is correct |
4 |
Correct |
3 ms |
384 KB |
Output is correct |
5 |
Correct |
3 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
2 ms |
384 KB |
Output is correct |
8 |
Correct |
2 ms |
384 KB |
Output is correct |
9 |
Correct |
10 ms |
384 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
2 ms |
384 KB |
Output is correct |
12 |
Correct |
2 ms |
384 KB |
Output is correct |
13 |
Correct |
3 ms |
384 KB |
Output is correct |
14 |
Correct |
3 ms |
384 KB |
Output is correct |
15 |
Correct |
2 ms |
384 KB |
Output is correct |
16 |
Correct |
2 ms |
384 KB |
Output is correct |
17 |
Correct |
11 ms |
384 KB |
Output is correct |
18 |
Correct |
3 ms |
384 KB |
Output is correct |
19 |
Correct |
6 ms |
384 KB |
Output is correct |
20 |
Execution timed out |
1053 ms |
384 KB |
Time limit exceeded |
21 |
Halted |
0 ms |
0 KB |
- |