Submission #647921

#TimeUsernameProblemLanguageResultExecution timeMemory
647921rainboyBroken Device 2 (JOI22_device2)C++17
25 / 100
2084 ms17560 KiB
/* 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...