이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/* https://www.ioi-jp.org/camp/2022/2022-sp-tasks/contest3/device2-review.pdf */
#include "Anna.h"
#include <vector>
using namespace std;
const int L = 2000;
typedef vector<int> vi;
namespace {
long long f(int l) {
return (l / 2 + 1) * ((l + 1) / 2 + 1);
}
}
int Declare() {
return L;
}
pair<vi, vi> Anna(long long x) {
x--;
int l = 1;
while (x >= f(l))
x -= f(l++);
vi aa(l, 0), bb(l, 0);
int kl = x % (l / 2 + 1), kr = x / (l / 2 + 1);
for (int i = 0; i < kl; i++)
aa[i] = bb[l / 2 - 1 - i] = 1;
for (int i = l / 2; i < l / 2 + kr; i++)
aa[i] = bb[l / 2 + l - 1 - i] = 1;
return make_pair(aa, bb);
}
/* https://www.ioi-jp.org/camp/2022/2022-sp-tasks/contest3/device2-review.pdf */
#include "Bruno.h"
#include <vector>
using namespace std;
typedef vector<int> vi;
namespace {
long long f(int l) {
return (l / 2 + 1) * ((l + 1) / 2 + 1);
}
}
long long Bruno(vi cc) {
int l = cc.size() / 2;
long long x = 1;
for (int l_ = 1; l_ < l; l_++)
x += f(l_);
int kl = 0;
for (int i = 0; i < l / 2; i++)
if (cc[i] == 1)
kl++;
int kr = 0;
for (int i = l * 2 - 1; i >= l * 2 - (l + 1) / 2; i--)
if (cc[i] == 1)
kr++;
return x + kr * (l / 2 + 1) + kl;
}
# | 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... |