Submission #546211

#TimeUsernameProblemLanguageResultExecution timeMemory
546211blueBroken Device 2 (JOI22_device2)C++17
80 / 100
584 ms4560 KiB
#include "Anna.h" #include <utility> #include <vector> #include <iostream> using namespace std; namespace { int variable_example = 0; using ll = long long; const int bits = 60; const int bs = 3; } int Declare() { return bs * bits; } std::pair<std::vector<int>, std::vector<int> > Anna(long long A) { vector<int> S, T; for(int i = 0; i < bits*bs/2; i++) { S.push_back(0); S.push_back(1); } ll pow2[bits]; pow2[0] = 1; for(int e = 1; e < bits; e++) pow2[e] = 2LL * pow2[e-1]; for(int i = 0; i < bits; i++) { for(int j = 0; j < bs; j++) { T.push_back(bool(A & pow2[i])); } } for(int i = 0; i < bits*bs; i++) cerr << S[i]; cerr << '\n'; for(int i = 0; i < bits*bs; i++) cerr << T[i]; cerr << '\n'; return make_pair(S, T); }
#include "Bruno.h" #include <utility> #include <vector> #include <iostream> using namespace std; namespace { int variable_example = 0; using vi = vector<int>; using ll = long long; const int bits = 60; const int bs = 3; } long long Bruno(vi u) { int sm = 0; ll res = 0; ll cp = 1; // cerr << "u = "; // for(int k:u) cerr << k; // cerr << '\n'; for(int i = 0; i < 2 * bits*bs; i++) { if(u[i] == 0) sm++; else sm--; // cerr << i << " : " << sm << '\n'; if(sm == bs) { cp *= 2; sm -= bs; // cerr << "+ detected\n"; } else if(sm == -bs + 1) { res += cp; // cerr << "adding " << cp << '\n'; cp *= 2; sm += bs; // cerr << "- detected\n"; } } // cerr << "returning " << res << '\n'; return res; }

Compilation message (stderr)

Anna.cpp:9:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    9 | int variable_example = 0;
      |     ^~~~~~~~~~~~~~~~

Bruno.cpp:10:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
   10 | 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...