제출 #1164619

#제출 시각아이디문제언어결과실행 시간메모리
1164619ThanhsBroken Device (JOI17_broken_device)C++20
0 / 100
2 ms320 KiB
#include "Annalib.h" #include <bits/stdc++.h> using namespace std; #define name "TENBAI" #define fi first #define se second #define setmin(x, y) x = min((x), (y)) #define setmax(x, y) x = max((x), (y)) #define sqr(x) ((x) * (x)) int v[] = {1, 2, 3}; vector<int> P(150); bool bl[150]; void Anna(int n, long long x, int k, int p[]) { memset(bl, 0, sizeof bl); iota(P.begin(), P.end(), 0); for (int i = 0; i < k; i++) bl[p[i]] = 1; int cr = 0; while (x) { while (1) { int t = bl[P[cr]] + bl[P[cr + 1]] * 2; if (t & v[x % 3]) { Set(P[cr], 0); Set(P[cr + 1], 0); cr += 2; continue; } Set(P[cr], v[x % 3] & 1); Set(P[cr + 1], v[x % 3] >> 1 & 1); cr += 2; break; } x /= 3; } while (cr < 150) Set(P[cr], 0), cr++; }
#include "Brunolib.h" #include <bits/stdc++.h> using namespace std; #define name "TENBAI" #define fi first #define se second #define setmin(x, y) x = min((x), (y)) #define setmax(x, y) x = max((x), (y)) #define sqr(x) ((x) * (x)) namespace B { vector<int> P(150); int v[] = {0, 0, 1, 2}; long long solve(int n, int a[]) { iota(P.begin(), P.end(), 0); long long res = 0, cr = 1; for (int i = 0; i < 150; i += 2) { if (!a[P[i]] && !a[P[i + 1]]) continue; res = res + v[a[P[i]] + a[P[i + 1]] * 2] * cr; cr *= 3; } return res; } } long long Bruno(int n, int a[]) { return B::solve(n, a); }
#Verdict Execution timeMemoryGrader output
Fetching results...