This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |