#include <vector>
#include <iostream>
using ll = long long;
using namespace std;
int main()
{
ll i, n, r, K;
cin >> K;
vector<ll> d(K);
for(i = 0; i < K; i++)
cin >> d[i];
i = 1;
while(true)
{
n = i;
while(n > 0)
{
r = n % K;
d[r]--;
if(d[r] < 0)
{
cout << i - 1 << endl;
return 0;
}
n /= K;
}
i++;
}
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1812 KiB | ||||
2 | Accepted | 10ms | 2012 KiB | ||||
3 | Time limit exceeded | 270ms | 2068 KiB | ||||
subtask2 | 25/25 | ||||||
4 | Accepted | 4ms | 2360 KiB | ||||
5 | Accepted | 6ms | 2468 KiB | ||||
6 | Accepted | 4ms | 2684 KiB | ||||
7 | Accepted | 10ms | 2812 KiB | ||||
8 | Accepted | 9ms | 2956 KiB | ||||
9 | Accepted | 14ms | 3284 KiB | ||||
10 | Accepted | 4ms | 3212 KiB | ||||
11 | Accepted | 7ms | 3444 KiB | ||||
12 | Accepted | 8ms | 3532 KiB | ||||
13 | Accepted | 10ms | 3668 KiB | ||||
14 | Accepted | 9ms | 3596 KiB | ||||
15 | Accepted | 10ms | 3684 KiB | ||||
16 | Accepted | 10ms | 3656 KiB | ||||
17 | Accepted | 9ms | 3784 KiB | ||||
18 | Accepted | 10ms | 4000 KiB | ||||
19 | Accepted | 8ms | 4216 KiB | ||||
subtask3 | 0/10 | ||||||
20 | Time limit exceeded | 298ms | 4280 KiB | ||||
21 | Time limit exceeded | 240ms | 4284 KiB | ||||
22 | Time limit exceeded | 264ms | 4352 KiB | ||||
23 | Accepted | 3ms | 4412 KiB | ||||
24 | Time limit exceeded | 298ms | 4360 KiB | ||||
subtask4 | 0/15 | ||||||
25 | Time limit exceeded | 231ms | 4360 KiB | ||||
26 | Time limit exceeded | 252ms | 4372 KiB | ||||
27 | Time limit exceeded | 259ms | 4488 KiB | ||||
28 | Time limit exceeded | 252ms | 4376 KiB | ||||
29 | Time limit exceeded | 256ms | 4380 KiB | ||||
30 | Accepted | 3ms | 4560 KiB | ||||
31 | Time limit exceeded | 298ms | 4736 KiB | ||||
32 | Time limit exceeded | 259ms | 4824 KiB | ||||
33 | Time limit exceeded | 244ms | 4968 KiB | ||||
subtask5 | 0/20 | ||||||
34 | Accepted | 3ms | 4872 KiB | ||||
35 | Accepted | 3ms | 4880 KiB | ||||
36 | Time limit exceeded | 270ms | 4880 KiB | ||||
37 | Time limit exceeded | 231ms | 4880 KiB | ||||
38 | Time limit exceeded | 256ms | 4984 KiB | ||||
39 | Time limit exceeded | 252ms | 4984 KiB | ||||
40 | Time limit exceeded | 256ms | 4408 KiB | ||||
41 | Time limit exceeded | 280ms | 5120 KiB | ||||
42 | Time limit exceeded | 263ms | 5012 KiB | ||||
subtask6 | 0/30 | ||||||
43 | Time limit exceeded | 261ms | 5012 KiB | ||||
44 | Time limit exceeded | 256ms | 4896 KiB | ||||
45 | Time limit exceeded | 268ms | 4900 KiB | ||||
46 | Time limit exceeded | 252ms | 4908 KiB | ||||
47 | Time limit exceeded | 268ms | 5040 KiB | ||||
48 | Time limit exceeded | 268ms | 5296 KiB | ||||
49 | Time limit exceeded | 254ms | 5264 KiB | ||||
50 | Time limit exceeded | 259ms | 5384 KiB | ||||
51 | Time limit exceeded | 259ms | 5512 KiB | ||||
52 | Accepted | 2ms | 5456 KiB | ||||
53 | Time limit exceeded | 298ms | 5512 KiB | ||||
54 | Time limit exceeded | 298ms | 5496 KiB | ||||
55 | Time limit exceeded | 263ms | 5276 KiB | ||||
56 | Time limit exceeded | 263ms | 5380 KiB | ||||
57 | Time limit exceeded | 272ms | 5540 KiB | ||||
58 | Time limit exceeded | 268ms | 5652 KiB | ||||
59 | Time limit exceeded | 263ms | 5068 KiB | ||||
60 | Time limit exceeded | 247ms | 5664 KiB |