Submission #718828

#TimeUsernameProblemLanguageResultExecution timeMemory
718828Hacv16Broken Device (JOI17_broken_device)C++17
0 / 100
2 ms568 KiB
#include "Annalib.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; void Anna(int N, ll X, int K, int P[]){ vector<bool> blocked(N); for(int i = 0; i < K; i++){ int curBit = P[i]; blocked[curBit] = true; } vector<int> goodPos; for(int i = 0; i < N; i++){ if(blocked[i] || (i != 0 && blocked[i - 1]) || (i != N - 1 && blocked[i + 1])) Set(i, 0); else goodPos.push_back(i); } for(int i = 0, j = 0; i < goodPos.size(); i += 2, j++){ int pos1 = goodPos[i], pos2 = goodPos[i + 1]; int bitOn = (bool)((1 << j) & X); Set(pos1, 1); Set(pos2, bitOn); } }
#include "Brunolib.h" #include <bits/stdc++.h> typedef long long ll; ll Bruno(int N, int A[]){ ll ans = 0; for(int i = 0, j = 0; i < N; i += 2){ if(A[i] == 0) continue; ans |= (A[i + 1] << j); j++; } return ans; }

Compilation message (stderr)

Anna.cpp: In function 'void Anna(int, ll, int, int*)':
Anna.cpp:22:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |     for(int i = 0, j = 0; i < goodPos.size(); i += 2, j++){
      |                           ~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...