This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//Challenge: Accepted
#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
#ifdef zisk
void debug(){cout << endl;}
template<class T, class ... U> void debug(T a, U ...b){cout << a << " ", debug(b...);}
template<class T> void pary(T l, T r) {
while (l != r) cout << *l << " ", l++;
cout << endl;
}
#else
#define debug(...) 0
#define pary(...) 0
#endif
#define ll long long
#define maxn 2005
#define pii pair<int, int>
#define ff first
#define ss second
int sum[maxn];
}
int Declare() {
for (int i = 1;i < maxn;i++) {
sum[i] = sum[i-1] + i * 2 + 1;
}
return 2000;
}
std::pair<std::vector<int>, std::vector<int> > Anna(long long A) {
int len = 0;
while (A > sum[len+1]) len++;
vector<int> X(len+1, 0);
vector<int> Y(len+1, 0);
A--;
for (int i = 0;i < min(len+1, int(A - sum[len]));i++) X[i] = 1;
for (int i = 0;i < min(len+1, int(A - sum[len] - (len+1)));i++) Y[i] = 1;
//pary(X.begin(), X.end());
//pary(Y.begin(), Y.end());
return make_pair(X, Y);
}
//Challenge: Accepted
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
#ifdef zisk
void debug(){cout << endl;}
template<class T, class ... U> void debug(T a, U ...b){cout << a << " ", debug(b...);}
template<class T> void pary(T l, T r) {
while (l != r) cout << *l << " ", l++;
cout << endl;
}
#else
#define debug(...) 0
#define pary(...) 0
#endif
#define ll long long
#define maxn 2005
#define pii pair<int, int>
#define ff first
#define ss second
namespace {
bool ini = 0;
int sum[maxn];
}
long long Bruno(std::vector<int> u) {
if (!ini) {
ini = 1;
for (int i = 1;i < maxn;i++) {
sum[i] = sum[i-1] + i * 2 + 1;
}
}
int len = u.size() / 2;
int ret = sum[len-1]+1;
for (int i = 0;i < 2*len;i++) {
if (u[i] == 1) ret++;
}
return ret;
}
# | 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... |