Submission #643772

#TimeUsernameProblemLanguageResultExecution timeMemory
643772gs14004Broken Device 2 (JOI22_device2)C++17
80 / 100
79 ms3116 KiB
#include "Anna.h" #include <bits/stdc++.h> using namespace std; using lint = long long; using pi = pair<lint, lint>; #define sz(v) ((int)(v).size()) #define all(v) (v).begin(), (v).end() namespace { } int Declare() { return 180; } std::pair<std::vector<int>, std::vector<int> > Anna(long long A) { vector<int> seq; for(int i = 0; i < 60; i++) seq.push_back((A >> i) & 1); vector<int> X, Y; for(int i = 0; i < 60; ){ int j = i; while(j < 60 && seq[i] == seq[j]) j++; for(int k = 0; k < 2 * (j - i) + 1; k++) X.push_back(seq[i]); i = j; } Y.resize(sz(X)); for(int i = 0; i < sz(X); i++){ Y[i] = (i + 1) % 2; } return make_pair(X, Y); }
#include "Bruno.h" #include <bits/stdc++.h> using namespace std; using lint = long long; using pi = pair<lint, lint>; #define sz(v) ((int)(v).size()) #define all(v) (v).begin(), (v).end() namespace { int variable_example = 0; } long long Bruno(std::vector<int> u) { int ptr = 0; int piv = 0, sum = 0; int previous = -1; vector<int> ans; while(ptr < sz(u)){ int k = piv; int U = (k + 3 - (previous == 1)); int D = (k - 3 + (previous == 0)); while(ptr < sz(u)){ sum += u[ptr++] * 2 - 1; if(sum >= U) break; if(sum <= D + 1) break; } if(sum == U) ans.push_back(1), previous = 1, piv = U; else if(sum == D + 1) ans.push_back(0), previous = 0, piv = D; } assert(sz(ans) == 60); lint dap = 0; for(int i = 0; i < 60; i++) if(ans[i]) dap |= (1ll << i); return dap; }

Compilation message (stderr)

Bruno.cpp:11:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
   11 | int variable_example = 0;
      |     ^~~~~~~~~~~~~~~~
#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...