제출 #295010

#제출 시각아이디문제언어결과실행 시간메모리
295010BTheroBroken Device (JOI17_broken_device)C++17
0 / 100
52 ms3376 KiB
// chrono::system_clock::now().time_since_epoch().count() #include "Annalib.h" #include<bits/stdc++.h> #define pb push_back #define eb emplace_back #define mp make_pair #define fi first #define se second #define all(x) (x).begin(), (x).end() #define debug(x) cerr << #x << " = " << x << endl; using namespace std; typedef long long ll; typedef pair<int, int> pii; namespace { int n, k, bad_pos[45]; int is_bad[150]; ll msg; int bit(ll x, int p) { if (p > 60) return 0; return (x >> p) & 1; } void solve() { assert(n % 2 == 0); fill(is_bad, is_bad + n, 0); for (int i = 0; i < k; ++i) { is_bad[bad_pos[i]] = 1; } int ptr = 0, i = 0; while (i < n) { if (is_bad[i]) { Set(i++, 0); } else { Set(i++, 1); if (i < n) { Set(i++, bit(msg, ptr++)); } } } } }; void Anna( int N, long long X, int K, int P[] ){ n = N; msg = X; k = K; for (int i = 0; i < k; ++i) { bad_pos[i] = P[i]; } solve(); }
// chrono::system_clock::now().time_since_epoch().count() #include "Brunolib.h" #include<bits/stdc++.h> #define pb push_back #define eb emplace_back #define mp make_pair #define fi first #define se second #define all(x) (x).begin(), (x).end() #define debug(x) cerr << #x << " = " << x << endl; using namespace std; typedef long long ll; typedef pair<int, int> pii; namespace { int n, arr[150]; ll solve() { assert(n % 2 == 0); ll ret = 0; int ptr = 0, i = 0; while (i < n) { if (arr[i] == 0) { i++; } else { i++; if (i < n && arr[i]) { ret += (1ll << ptr++); i++; } } } return ret; } }; long long Bruno( int N, int A[] ){ n = N; for (int i = 0; i < n; ++i) { arr[i] = A[i]; } return solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...