제출 #923154

#제출 시각아이디문제언어결과실행 시간메모리
923154gawr_guraBroken Device (JOI17_broken_device)C++17
85 / 100
32 ms2836 KiB
#include <bits/stdc++.h> #include "Annalib.h" using namespace std; void Anna(int N, long long X, int K, int P[]) { vector<int> a(N); vector<int> wrong(N); for (int i = 0; i < K; i++) wrong[P[i]] = 1; for (int i = 0; i < N / 2; i++) { if (wrong[i] || wrong[i + N / 2]) { Set(i, 0), Set(i + N / 2, 0); } else { int z = X % 3; X /= 3; if (z == 0) Set(i, 1), Set(i + N / 2, 1); if (z == 1) Set(i, 0), Set(i + N / 2, 1); if (z == 2) Set(i, 1), Set(i + N / 2, 0); } } }
#include <bits/stdc++.h> #include "Brunolib.h" using namespace std; long long Bruno(int N, int A[]) { int64_t X = 0; for (int i = N / 2 - 1; i >= 0; i--) { if (A[i] == A[i + N / 2]) { if (A[i] == 0) continue; if (A[i] == 1) X *= 3; } else { X *= 3; if (A[i] == 0) X += 1; if (A[i] == 1) X += 2; } } return X; }
#Verdict Execution timeMemoryGrader output
Fetching results...