#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define endl '\n'
#define pi acos(-1)
#define pque priority_queue
typedef pair < int, int > ii;
typedef vector < int > vi;
typedef vector < vi > vii;
int mod = 1000000007;
int n, m, a[100009], j, num[10000009], nex, cur, t = 1, ans[10000009];
signed main()
{
cin >> n >> m;
for(int i = 1; i <= n; i++)
cin >> a[i];
for(int i = 1; i <= n; i++)
{
j = 0;
while(j <= 10000000)
{
num[j] = max(num[j], a[i]);
j += a[i];
}
}
nex = num[0];
num[1] = num[0] - 1;
for(int i = 2; i <= 10; i++)
{
int k = 0;
while(i >= nex && cur < i)
{
cur ++;
k = 1;
nex = num[cur] + cur;
}
if(cur == i)
break;
ans[i] = ans[cur] + 1;
}
while(m --)
{
int k;
cin >> k;
if(ans[k])
cout << ans[k] << endl;
else
cout << "oo" << endl;
}
}
Compilation message
brunhilda.cpp: In function 'int main()':
brunhilda.cpp:33:7: warning: variable 'k' set but not used [-Wunused-but-set-variable]
int k = 0;
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
16 ms |
80532 KB |
Output isn't correct |
2 |
Incorrect |
46 ms |
80532 KB |
Output isn't correct |
3 |
Incorrect |
23 ms |
80532 KB |
Output isn't correct |
4 |
Incorrect |
49 ms |
80532 KB |
Output isn't correct |
5 |
Incorrect |
33 ms |
80532 KB |
Output isn't correct |
6 |
Incorrect |
26 ms |
80532 KB |
Output isn't correct |
7 |
Incorrect |
33 ms |
80532 KB |
Output isn't correct |
8 |
Incorrect |
39 ms |
80532 KB |
Output isn't correct |
9 |
Incorrect |
63 ms |
80532 KB |
Output isn't correct |
10 |
Incorrect |
106 ms |
80532 KB |
Output isn't correct |
11 |
Incorrect |
103 ms |
80532 KB |
Output isn't correct |
12 |
Incorrect |
23 ms |
80532 KB |
Output isn't correct |
13 |
Incorrect |
246 ms |
80532 KB |
Output isn't correct |
14 |
Incorrect |
316 ms |
80532 KB |
Output isn't correct |
15 |
Incorrect |
73 ms |
80532 KB |
Output isn't correct |
16 |
Incorrect |
46 ms |
80532 KB |
Output isn't correct |
17 |
Incorrect |
126 ms |
80532 KB |
Output isn't correct |
18 |
Incorrect |
36 ms |
80532 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
49 ms |
80532 KB |
Output isn't correct |
2 |
Incorrect |
99 ms |
80532 KB |
Output isn't correct |
3 |
Incorrect |
356 ms |
80532 KB |
Output isn't correct |
4 |
Incorrect |
86 ms |
80532 KB |
Output isn't correct |
5 |
Incorrect |
206 ms |
80532 KB |
Output isn't correct |
6 |
Incorrect |
53 ms |
80532 KB |
Output isn't correct |
7 |
Incorrect |
43 ms |
80532 KB |
Output isn't correct |
8 |
Incorrect |
83 ms |
80532 KB |
Output isn't correct |
9 |
Incorrect |
269 ms |
80532 KB |
Output isn't correct |
10 |
Incorrect |
349 ms |
80532 KB |
Output isn't correct |
11 |
Incorrect |
356 ms |
80532 KB |
Output isn't correct |
12 |
Incorrect |
143 ms |
80532 KB |
Output isn't correct |
13 |
Incorrect |
29 ms |
80532 KB |
Output isn't correct |
14 |
Incorrect |
89 ms |
80532 KB |
Output isn't correct |
15 |
Incorrect |
249 ms |
80532 KB |
Output isn't correct |
16 |
Incorrect |
83 ms |
80532 KB |
Output isn't correct |
17 |
Incorrect |
253 ms |
80532 KB |
Output isn't correct |
18 |
Incorrect |
276 ms |
80532 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
313 ms |
80532 KB |
Output isn't correct |
2 |
Incorrect |
436 ms |
80532 KB |
Output isn't correct |
3 |
Incorrect |
463 ms |
80532 KB |
Output isn't correct |
4 |
Incorrect |
286 ms |
80532 KB |
Output isn't correct |
5 |
Incorrect |
253 ms |
80532 KB |
Output isn't correct |
6 |
Runtime error |
346 ms |
80532 KB |
Execution timed out (wall clock limit exceeded) |
7 |
Incorrect |
419 ms |
80532 KB |
Output isn't correct |
8 |
Incorrect |
356 ms |
80532 KB |
Output isn't correct |
9 |
Incorrect |
353 ms |
80532 KB |
Output isn't correct |
10 |
Incorrect |
203 ms |
80532 KB |
Output isn't correct |
11 |
Incorrect |
289 ms |
80532 KB |
Output isn't correct |
12 |
Incorrect |
396 ms |
80532 KB |
Output isn't correct |
13 |
Runtime error |
449 ms |
80532 KB |
Execution timed out (wall clock limit exceeded) |
14 |
Runtime error |
219 ms |
80532 KB |
Execution timed out (wall clock limit exceeded) |
15 |
Incorrect |
316 ms |
80532 KB |
Output isn't correct |
16 |
Incorrect |
423 ms |
80532 KB |
Output isn't correct |
17 |
Incorrect |
309 ms |
80532 KB |
Output isn't correct |
18 |
Incorrect |
469 ms |
80532 KB |
Output isn't correct |
19 |
Incorrect |
86 ms |
80532 KB |
Output isn't correct |
20 |
Runtime error |
556 ms |
80532 KB |
Execution timed out (wall clock limit exceeded) |
21 |
Runtime error |
276 ms |
80532 KB |
Execution timed out (wall clock limit exceeded) |
22 |
Runtime error |
469 ms |
80532 KB |
Execution timed out (wall clock limit exceeded) |
23 |
Runtime error |
219 ms |
80532 KB |
Execution timed out (wall clock limit exceeded) |
24 |
Runtime error |
156 ms |
80532 KB |
Execution timed out (wall clock limit exceeded) |
25 |
Runtime error |
296 ms |
80532 KB |
Execution timed out (wall clock limit exceeded) |
26 |
Runtime error |
303 ms |
80532 KB |
Execution timed out (wall clock limit exceeded) |
27 |
Incorrect |
563 ms |
80532 KB |
Output isn't correct |
28 |
Runtime error |
213 ms |
80532 KB |
Execution timed out (wall clock limit exceeded) |
29 |
Runtime error |
519 ms |
80532 KB |
Execution timed out (wall clock limit exceeded) |
30 |
Runtime error |
469 ms |
80532 KB |
Execution timed out (wall clock limit exceeded) |
31 |
Runtime error |
229 ms |
80532 KB |
Execution timed out (wall clock limit exceeded) |
32 |
Runtime error |
229 ms |
80532 KB |
Execution timed out (wall clock limit exceeded) |
33 |
Runtime error |
206 ms |
80532 KB |
Execution timed out (wall clock limit exceeded) |
34 |
Runtime error |
369 ms |
80532 KB |
Execution timed out (wall clock limit exceeded) |
35 |
Runtime error |
223 ms |
80532 KB |
Execution timed out (wall clock limit exceeded) |
36 |
Runtime error |
493 ms |
80532 KB |
Execution timed out (wall clock limit exceeded) |
37 |
Runtime error |
256 ms |
80532 KB |
Execution timed out (wall clock limit exceeded) |
38 |
Runtime error |
496 ms |
80532 KB |
Execution timed out (wall clock limit exceeded) |
39 |
Runtime error |
209 ms |
80532 KB |
Execution timed out (wall clock limit exceeded) |
40 |
Runtime error |
306 ms |
80532 KB |
Execution timed out (wall clock limit exceeded) |
41 |
Incorrect |
296 ms |
80532 KB |
Output isn't correct |
42 |
Runtime error |
429 ms |
80532 KB |
Execution timed out (wall clock limit exceeded) |