Submission #1205938

#TimeUsernameProblemLanguageResultExecution timeMemory
1205938Sir_Ahmed_ImranBroken Device (JOI17_broken_device)C++17
57 / 100
20 ms1524 KiB
#include "Annalib.h" #include <bits/stdc++.h> using namespace std; #define nl '\n' #define ff first #define ss second #define add insert #define ll long long #define ld long double #define terminator main #define pll pair<ll,ll> #define append push_back #define pii pair<int,int> #define all(x) (x).begin(),(x).end() #define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) void Anna(int n, ll x, int k, int p[]){ int b; bool a[n]; vector<bool> v; for(int i = 0; i < 60; i++){ v.append(x & 1); x = x >> 1; } reverse(all(v)); for(int i = 0; i < n; i++) a[i] = 1; for(int i = 0; i < k; i++) a[p[i]] = 0; for(int i = b = 0; i < n; i += 3){ if(b < 59 && !v[b] && !v[b + 1] && a[i] && a[i + 1] && a[i + 2]) Set(i, 1), Set(i + 1, 1), Set(i + 2, 1), b += 2; else if(b < 59 && !v[b] && v[b + 1] && a[i + 1] && a[i + 2]) Set(i, 0), Set(i + 1, 1), Set(i + 2, 1), b += 2; else if(b < 59 && v[b] && !v[b + 1] && a[i]) Set(i, 1), Set(i + 1, 0), Set(i + 2, 0), b += 2; else if(b < 59 && v[b] && v[b + 1] && a[i] && a[i + 2]) Set(i, 1), Set(i + 1, 0), Set(i + 2, 1), b += 2; else if(b < 60 && !v[b] && a[i + 2]) Set(i, 0), Set(i + 1, 0), Set(i + 2, 1), b++; else if(b < 60 && !v[b] && a[i] && a[i + 1]) Set(i, 1), Set(i + 1, 1), Set(i + 2, 0), b++; else if(b < 60 && v[b] && a[i + 1]) Set(i, 0), Set(i + 1, 1), Set(i + 2, 0), b++; else Set(i, 0), Set(i + 1, 0), Set(i + 2, 0); } }
#include "Brunolib.h" #include <bits/stdc++.h> using namespace std; #define nl '\n' #define ff first #define ss second #define add insert #define ll long long #define ld long double #define terminator main #define pll pair<ll,ll> #define append push_back #define pii pair<int,int> #define all(x) (x).begin(),(x).end() #define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) ll Bruno(int n, int a[]){ ll x; for(int i = x = 0; i < n; i += 3){ if(!a[i] && !a[i + 1] && a[i + 2]) x = x * 2 + 0; else if(!a[i] && a[i + 1] && !a[i + 2]) x = x * 2 + 1; else if(!a[i] && a[i + 1] && a[i + 2]) x = x * 4 + 1; else if(a[i] && !a[i + 1] && !a[i + 2]) x = x * 4 + 2; else if(a[i] && !a[i + 1] && a[i + 2]) x = x * 4 + 3; else if(a[i] && a[i + 1] && !a[i + 2]) x = x * 2 + 0; else if(a[i] && a[i + 1] && a[i + 2]) x = x * 4 + 0; } return x; }
#Verdict Execution timeMemoryGrader output
Fetching results...