Submission #643086

#TimeUsernameProblemLanguageResultExecution timeMemory
643086cologneBroken Device 2 (JOI22_device2)C++17
13 / 100
546 ms25840 KiB
#include "Anna.h" #include <bits/stdc++.h> using namespace std; int Declare() { return 2000; } namespace { int count(int N) { if (N < 2) return 0; return 4 * (2 * N - 4 + 1); } pair<vector<int>, vector<int>> solve(int N, int A) { int v = N / 3; vector<int> L(N), R(N); if (A % 2 == 1) L[0] = R[0] = 1; A /= 2; if (A % 2 == 1) L.back() = R.back() = 1; A /= 2; for (int i = 0; i < A; i++) { if (i < N - 2) L[i + 1] = 1; else R[i - (N - 2) + 1] = 1; } return {L, R}; } } pair<vector<int>, vector<int>> Anna(long long A) { --A; for (int i = 1; i <= 2000; i++) { long long K = count(i); if (A >= K) A -= K; else return solve(i, A); } assert(false); }
#include "Bruno.h" #include <bits/stdc++.h> using namespace std; namespace { int count(int N) { if (N < 2) return 0; return 4 * (2 * N - 4 + 1); } long long solve(vector<int> u) { int N = u.size() / 2; int L = u[0], R = u.back(); int C = count(u.begin(), u.end(), 1) - 2 * L - 2 * R; return 4 * C + 2 * R + L; } } long long Bruno(vector<int> u) { long long ans = 1; for (int i = 1; i < (int)u.size() / 2; i++) ans += count(i); return ans + solve(u); }

Compilation message (stderr)

Anna.cpp: In function 'std::pair<std::vector<int>, std::vector<int> > {anonymous}::solve(int, int)':
Anna.cpp:20:13: warning: unused variable 'v' [-Wunused-variable]
   20 |         int v = N / 3;
      |             ^

Bruno.cpp: In function 'long long int {anonymous}::solve(std::vector<int>)':
Bruno.cpp:15:13: warning: unused variable 'N' [-Wunused-variable]
   15 |         int N = u.size() / 2;
      |             ^
#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...