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 <bits/stdc++.h>
#include "Anna.h"
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define FOR(i, j, k) for (int i = j, Z = k; i < Z; i++)
typedef pair<int, int> pii;
using ll = long long;
namespace {
}
int Declare() {
return 2000;
}
pair<vector<int>, vector<int>> Anna(ll A) {
int mul = (A - 1) / (2500000);
A %= 2500000;
if (A == 0) A = 2500000;
vector<int> v, w;
for (int i = 0; true; i += 2) {
if (A - (i + 1) <= 0) {
A--;
FOR(j, 0, A) v.push_back(1);
FOR(j, A, i) v.push_back(0);
break;
}
A -= (i + 1);
}
FOR(i, 0, v.size() / 2) {
w.push_back(v.back());
v.pop_back();
}
v.insert(v.begin(), 1);
v.insert(v.begin(), 0);
v.push_back(1);
v.push_back(0);
w.insert(w.begin(), 1);
w.insert(w.begin(), 0);
w.push_back(1);
w.push_back(0);
if (mul & 2) {
swap(v[0], v[1]);
swap(w[0], w[1]);
}
if (mul & 1) {
swap(v[v.size() - 1], v[v.size() - 2]);
swap(w[w.size() - 1], w[w.size() - 2]);
}
return mp(v, w);
}
#include <bits/stdc++.h>
#include "Bruno.h"
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define FOR(i, j, k) for (int i = j, Z = k; i < Z; i++)
typedef pair<int, int> pii;
using ll = long long;
namespace {
}
ll Bruno(std::vector<int> u) {
ll ans = 2500000 * (u.front() * 2 + u.back());
ans += ((u.size() - 8) / 2) * ((u.size() - 8) / 2);
int x = count(u.begin(), u.end(), 1);
x -= 4;
ans += x + 1;
return ans;
}
# | 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... |