Submission #565301

#TimeUsernameProblemLanguageResultExecution timeMemory
565301SortingBroken Device 2 (JOI22_device2)C++17
25 / 100
87 ms3524 KiB
#include "Anna.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; static const int BITS = 60; int Declare() { return 3 * BITS; } pair<vector<int>, vector<int>> Anna(ll a) { vector<int> v1, v2; for(int i = 0; i < 3 * BITS; i += 2){ v1.push_back(0); v1.push_back(1); } for(ll i = 0; i < BITS; ++i){ int bit = (a >> i) & 1ll; v2.push_back(bit); v2.push_back(bit); v2.push_back(bit); } return {v1, v2}; }
#include "Bruno.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; static const int BITS = 60; ll Bruno(vector<int> u) { int curr = 0, prefix = 0; vector<int> bits; for(int i = 0; i < u.size(); ++i){ prefix += u[i] ? 1 : -1; if(prefix <= curr - 3){ bits.push_back(0); curr -= 3; } else if(prefix >= curr + 2){ bits.push_back(1); curr += 3; } } ll ans = 0; for(ll i = 0; i < bits.size(); ++i) ans += bits[i] << i; assert(bits.size() == BITS); return ans; }

Compilation message (stderr)

Bruno.cpp: In function 'll Bruno(std::vector<int>)':
Bruno.cpp:13:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |     for(int i = 0; i < u.size(); ++i){
      |                    ~~^~~~~~~~~~
Bruno.cpp:27:21: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |     for(ll i = 0; i < bits.size(); ++i)
      |                   ~~^~~~~~~~~~~~~
#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...