Submission #31860

# Submission time Handle Problem Language Result Execution time Memory
31860 2017-09-11T07:54:04 Z YoLo Brunhilda’s Birthday (BOI13_brunhilda) C++14
55.7143 / 100
629 ms 80532 KB
#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], j + a[i]);
			j += a[i];
		}
	}
	num[1] = num[0];
	ans[1] = 1;
	for(int i = 2; i <= 10000000; i++)
	{
		int k = 0;
		while(i >= num[cur] && cur < i)
		{
			cur ++;
			k = 1;
		}
		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;
       ^
# Verdict Execution time Memory Grader output
1 Correct 19 ms 80532 KB Output is correct
2 Correct 93 ms 80532 KB Output is correct
3 Correct 33 ms 80532 KB Output is correct
4 Correct 66 ms 80532 KB Output is correct
5 Correct 83 ms 80532 KB Output is correct
6 Correct 16 ms 80532 KB Output is correct
7 Correct 33 ms 80532 KB Output is correct
8 Correct 46 ms 80532 KB Output is correct
9 Correct 106 ms 80532 KB Output is correct
10 Correct 136 ms 80532 KB Output is correct
11 Correct 119 ms 80532 KB Output is correct
12 Correct 46 ms 80532 KB Output is correct
13 Correct 293 ms 80532 KB Output is correct
14 Correct 329 ms 80532 KB Output is correct
15 Correct 93 ms 80532 KB Output is correct
16 Correct 86 ms 80532 KB Output is correct
17 Correct 103 ms 80532 KB Output is correct
18 Correct 66 ms 80532 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 83 ms 80532 KB Output is correct
2 Correct 99 ms 80532 KB Output is correct
3 Correct 353 ms 80532 KB Output is correct
4 Correct 123 ms 80532 KB Output is correct
5 Correct 246 ms 80532 KB Output is correct
6 Correct 76 ms 80532 KB Output is correct
7 Correct 83 ms 80532 KB Output is correct
8 Correct 103 ms 80532 KB Output is correct
9 Correct 283 ms 80532 KB Output is correct
10 Correct 356 ms 80532 KB Output is correct
11 Correct 349 ms 80532 KB Output is correct
12 Correct 176 ms 80532 KB Output is correct
13 Correct 66 ms 80532 KB Output is correct
14 Correct 126 ms 80532 KB Output is correct
15 Correct 283 ms 80532 KB Output is correct
16 Correct 119 ms 80532 KB Output is correct
17 Correct 309 ms 80532 KB Output is correct
18 Correct 313 ms 80532 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 426 ms 80532 KB Execution timed out (wall clock limit exceeded)
2 Correct 506 ms 80532 KB Output is correct
3 Runtime error 536 ms 80532 KB Execution timed out (wall clock limit exceeded)
4 Runtime error 319 ms 80532 KB Execution timed out (wall clock limit exceeded)
5 Runtime error 306 ms 80532 KB Execution timed out (wall clock limit exceeded)
6 Runtime error 386 ms 80532 KB Execution timed out (wall clock limit exceeded)
7 Runtime error 473 ms 80532 KB Execution timed out (wall clock limit exceeded)
8 Runtime error 513 ms 80532 KB Execution timed out (wall clock limit exceeded)
9 Correct 396 ms 80532 KB Output is correct
10 Correct 233 ms 80532 KB Output is correct
11 Correct 283 ms 80532 KB Output is correct
12 Correct 306 ms 80532 KB Output is correct
13 Runtime error 483 ms 80532 KB Execution timed out (wall clock limit exceeded)
14 Runtime error 306 ms 80532 KB Execution timed out (wall clock limit exceeded)
15 Correct 316 ms 80532 KB Output is correct
16 Correct 399 ms 80532 KB Output is correct
17 Correct 313 ms 80532 KB Output is correct
18 Correct 509 ms 80532 KB Output is correct
19 Correct 166 ms 80532 KB Output is correct
20 Runtime error 546 ms 80532 KB Execution timed out (wall clock limit exceeded)
21 Runtime error 389 ms 80532 KB Execution timed out (wall clock limit exceeded)
22 Runtime error 556 ms 80532 KB Execution timed out (wall clock limit exceeded)
23 Runtime error 253 ms 80532 KB Execution timed out (wall clock limit exceeded)
24 Runtime error 226 ms 80532 KB Execution timed out (wall clock limit exceeded)
25 Runtime error 386 ms 80532 KB Execution timed out (wall clock limit exceeded)
26 Runtime error 369 ms 80532 KB Execution timed out (wall clock limit exceeded)
27 Runtime error 629 ms 80532 KB Execution timed out (wall clock limit exceeded)
28 Runtime error 189 ms 80532 KB Execution timed out (wall clock limit exceeded)
29 Runtime error 529 ms 80532 KB Execution timed out (wall clock limit exceeded)
30 Runtime error 466 ms 80532 KB Execution timed out (wall clock limit exceeded)
31 Runtime error 279 ms 80532 KB Execution timed out (wall clock limit exceeded)
32 Runtime error 333 ms 80532 KB Execution timed out (wall clock limit exceeded)
33 Runtime error 223 ms 80532 KB Execution timed out (wall clock limit exceeded)
34 Runtime error 416 ms 80532 KB Execution timed out (wall clock limit exceeded)
35 Runtime error 249 ms 80532 KB Execution timed out (wall clock limit exceeded)
36 Correct 573 ms 80532 KB Output is correct
37 Runtime error 313 ms 80532 KB Execution timed out (wall clock limit exceeded)
38 Runtime error 473 ms 80532 KB Execution timed out (wall clock limit exceeded)
39 Runtime error 193 ms 80532 KB Execution timed out (wall clock limit exceeded)
40 Runtime error 389 ms 80532 KB Execution timed out (wall clock limit exceeded)
41 Runtime error 386 ms 80532 KB Execution timed out (wall clock limit exceeded)
42 Runtime error 489 ms 80532 KB Execution timed out (wall clock limit exceeded)