#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
int Declare()
{
return 2000;
}
namespace
{
int count(int N)
{
if (N < 2)
return 0;
return 4 * (2 * N - 4 + 1);
}
pair<vector<int>, vector<int>> solve(int N, int A)
{
int v = N / 3;
vector<int> L(N), R(N);
if (A % 2 == 1)
L[0] = R[0] = 1;
A /= 2;
if (A % 2 == 1)
L.back() = R.back() = 1;
A /= 2;
for (int i = 0; i < A; i++)
{
if (i < N - 2)
L[i + 1] = 1;
else
R[i - (N - 2) + 1] = 1;
}
return {L, R};
}
}
pair<vector<int>, vector<int>> Anna(long long A)
{
--A;
for (int i = 1; i <= 2000; i++)
{
long long K = count(i);
if (A >= K)
A -= K;
else
return solve(i, A);
}
assert(false);
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
namespace
{
int count(int N)
{
if (N < 2)
return 0;
return 4 * (2 * N - 4 + 1);
}
long long solve(vector<int> u)
{
int N = u.size() / 2;
int L = u[0], R = u.back();
int C = count(u.begin(), u.end(), 1) - 2 * L - 2 * R;
return 4 * C + 2 * R + L;
}
}
long long Bruno(vector<int> u)
{
long long ans = 1;
for (int i = 1; i < (int)u.size() / 2; i++)
ans += count(i);
return ans + solve(u);
}
Compilation message
Anna.cpp: In function 'std::pair<std::vector<int>, std::vector<int> > {anonymous}::solve(int, int)':
Anna.cpp:20:13: warning: unused variable 'v' [-Wunused-variable]
20 | int v = N / 3;
| ^
Bruno.cpp: In function 'long long int {anonymous}::solve(std::vector<int>)':
Bruno.cpp:15:13: warning: unused variable 'N' [-Wunused-variable]
15 | int N = u.size() / 2;
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
508 KB |
Output is correct |
2 |
Correct |
12 ms |
812 KB |
Output is correct |
3 |
Correct |
15 ms |
968 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
508 KB |
Output is correct |
2 |
Correct |
12 ms |
812 KB |
Output is correct |
3 |
Correct |
15 ms |
968 KB |
Output is correct |
4 |
Correct |
254 ms |
11576 KB |
Output is correct |
5 |
Correct |
241 ms |
11292 KB |
Output is correct |
6 |
Correct |
274 ms |
11536 KB |
Output is correct |
7 |
Correct |
236 ms |
11364 KB |
Output is correct |
8 |
Correct |
246 ms |
11588 KB |
Output is correct |
9 |
Correct |
355 ms |
16580 KB |
Output is correct |
10 |
Correct |
339 ms |
16480 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
508 KB |
Output is correct |
2 |
Correct |
12 ms |
812 KB |
Output is correct |
3 |
Correct |
15 ms |
968 KB |
Output is correct |
4 |
Correct |
254 ms |
11576 KB |
Output is correct |
5 |
Correct |
241 ms |
11292 KB |
Output is correct |
6 |
Correct |
274 ms |
11536 KB |
Output is correct |
7 |
Correct |
236 ms |
11364 KB |
Output is correct |
8 |
Correct |
246 ms |
11588 KB |
Output is correct |
9 |
Correct |
355 ms |
16580 KB |
Output is correct |
10 |
Correct |
339 ms |
16480 KB |
Output is correct |
11 |
Correct |
392 ms |
17976 KB |
Output is correct |
12 |
Correct |
378 ms |
17744 KB |
Output is correct |
13 |
Correct |
373 ms |
17532 KB |
Output is correct |
14 |
Correct |
375 ms |
17612 KB |
Output is correct |
15 |
Correct |
373 ms |
17656 KB |
Output is correct |
16 |
Correct |
538 ms |
25812 KB |
Output is correct |
17 |
Correct |
546 ms |
25840 KB |
Output is correct |
18 |
Correct |
280 ms |
12996 KB |
Output is correct |
19 |
Correct |
284 ms |
13412 KB |
Output is correct |
20 |
Correct |
274 ms |
12952 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
508 KB |
Output is correct |
2 |
Correct |
12 ms |
812 KB |
Output is correct |
3 |
Correct |
15 ms |
968 KB |
Output is correct |
4 |
Correct |
254 ms |
11576 KB |
Output is correct |
5 |
Correct |
241 ms |
11292 KB |
Output is correct |
6 |
Correct |
274 ms |
11536 KB |
Output is correct |
7 |
Correct |
236 ms |
11364 KB |
Output is correct |
8 |
Correct |
246 ms |
11588 KB |
Output is correct |
9 |
Correct |
355 ms |
16580 KB |
Output is correct |
10 |
Correct |
339 ms |
16480 KB |
Output is correct |
11 |
Correct |
392 ms |
17976 KB |
Output is correct |
12 |
Correct |
378 ms |
17744 KB |
Output is correct |
13 |
Correct |
373 ms |
17532 KB |
Output is correct |
14 |
Correct |
375 ms |
17612 KB |
Output is correct |
15 |
Correct |
373 ms |
17656 KB |
Output is correct |
16 |
Correct |
538 ms |
25812 KB |
Output is correct |
17 |
Correct |
546 ms |
25840 KB |
Output is correct |
18 |
Correct |
280 ms |
12996 KB |
Output is correct |
19 |
Correct |
284 ms |
13412 KB |
Output is correct |
20 |
Correct |
274 ms |
12952 KB |
Output is correct |
21 |
Runtime error |
1 ms |
596 KB |
Execution killed with signal 6 |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
508 KB |
Output is correct |
2 |
Correct |
12 ms |
812 KB |
Output is correct |
3 |
Correct |
15 ms |
968 KB |
Output is correct |
4 |
Correct |
254 ms |
11576 KB |
Output is correct |
5 |
Correct |
241 ms |
11292 KB |
Output is correct |
6 |
Correct |
274 ms |
11536 KB |
Output is correct |
7 |
Correct |
236 ms |
11364 KB |
Output is correct |
8 |
Correct |
246 ms |
11588 KB |
Output is correct |
9 |
Correct |
355 ms |
16580 KB |
Output is correct |
10 |
Correct |
339 ms |
16480 KB |
Output is correct |
11 |
Correct |
392 ms |
17976 KB |
Output is correct |
12 |
Correct |
378 ms |
17744 KB |
Output is correct |
13 |
Correct |
373 ms |
17532 KB |
Output is correct |
14 |
Correct |
375 ms |
17612 KB |
Output is correct |
15 |
Correct |
373 ms |
17656 KB |
Output is correct |
16 |
Correct |
538 ms |
25812 KB |
Output is correct |
17 |
Correct |
546 ms |
25840 KB |
Output is correct |
18 |
Correct |
280 ms |
12996 KB |
Output is correct |
19 |
Correct |
284 ms |
13412 KB |
Output is correct |
20 |
Correct |
274 ms |
12952 KB |
Output is correct |
21 |
Runtime error |
1 ms |
596 KB |
Execution killed with signal 6 |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |