//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);
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];
for (int i = 0;i < 2*len;i++) {
if (u[i] == 1) ret++;
}
return ret;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
524 KB |
Output is correct |
2 |
Incorrect |
15 ms |
964 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
524 KB |
Output is correct |
2 |
Incorrect |
15 ms |
964 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
524 KB |
Output is correct |
2 |
Incorrect |
15 ms |
964 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
524 KB |
Output is correct |
2 |
Incorrect |
15 ms |
964 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
524 KB |
Output is correct |
2 |
Incorrect |
15 ms |
964 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |