Submission #100066

#TimeUsernameProblemLanguageResultExecution timeMemory
100066shenxyBroken Device (JOI17_broken_device)C++11
0 / 100
76 ms3328 KiB
#include "Annalib.h" #include <algorithm> #include <deque> #include <unordered_set> using namespace std; void Anna(int N, long long X, int K, int P[]) { deque<int> mybitset; int ptr = 0; unordered_set<int> brokenbits; for (int i = 0; i < K; i++) brokenbits.insert(P[i]); while (X) { if (brokenbits.find(ptr) != brokenbits.end() || brokenbits.find(ptr + 1) != brokenbits.end()) { mybitset.push_back(0); mybitset.push_back(0); } else { if (X % 2) { mybitset.push_back(1); mybitset.push_back(0); } else { mybitset.push_back(1); mybitset.push_back(1); } } ptr += 2; X = X >> 1; } for (int i = 0; i < N; i++) { if (i < mybitset.size()) Set(i, mybitset[i]); else Set(i, 0); } }
#include "Brunolib.h" #include <algorithm> using namespace std; long long Bruno(int N, int A[]) { int ptr = N - 2; long long int ans = 0; while (ptr >= 0) { int a = A[ptr], b = A[ptr + 1]; if (a == 0 && b == 0); else if (a == 1 && b == 1) ans *= 2; else ans = ans * 2 + 1; ptr -= 2; } return ans; }

Compilation message (stderr)

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:28:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (i < mybitset.size()) Set(i, mybitset[i]);
             ~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...