제출 #492760

#제출 시각아이디문제언어결과실행 시간메모리
492760HabitusBroken Device (JOI17_broken_device)C++14
0 / 100
39 ms2420 KiB
#include "Annalib.h" #include<bits/stdc++.h> #define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define dec(x, y) fixed << setprecision((y)) << (x) #define xx first #define yy second #define srt(v) sort((v).begin(), (v).end()) #define srtr(v) sort((v).rbegin(), (v).rend()) #define pb push_back #define popb pop_back #define sz(a) (int)(a).size() #define len(a) (int)(a).length() #define mp make_pair using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; void Anna(int N, ll X, int K, int P[]) { bool pokv[150]={0}; bool broj[61]={0}; for(int i=0; i<60; i++) { broj[i]=(bool)(X&(1LL<<i)); } for(int i=0; i<K; i++) { pokv[P[i]]=1; } int j=0; for(int i=0; i<N; i+=3) { int kolko=(int)pokv[i]+(int)pokv[i+1]+(int)pokv[i+2]; if(kolko>=2 || j>=60) { Set(i, 0); Set(i+1, 0); Set(i+2, 0); continue; } else if(kolko==1) { int koji; if(pokv[i]) koji=0; else if(pokv[i+1]) koji=1; else koji=2; if(koji==0) { if(broj[j]==0 && broj[j+1]==0) { Set(i, 0); Set(i+1, 0); Set(i+2, 1); j+=2; continue; } else if(broj[j]==0) { Set(i, 0); Set(i+1, 1); Set(i+2, 0); j++; continue; } else { Set(i, 0); Set(i+1, 1); Set(i+2, 1); j++; continue; } } else if(koji==1) { if(broj[j]==0 && broj[j+1]==0) { Set(i, 0); Set(i+1, 0); Set(i+2, 1); j+=2; continue; } else if(broj[j]==0) { Set(i, 1); Set(i+1, 0); Set(i+2, 1); j+=2; continue; } else { Set(i, 1); Set(i+1, 0); Set(i+2, 0); j++; continue; } } else { if(broj[j]==1 && broj[j+1]==0) { Set(i, 1); Set(i+1, 1); Set(i+2, 0); j+=2; continue; } else if(broj[j]==1) { Set(i, 1); Set(i+1, 0); Set(i+2, 0); j++; continue; } else { Set(i, 0); Set(i+1, 1); Set(i+2, 0); j++; continue; } } } else { if(broj[j]==0 && broj[j+1]==0) { Set(i, 0); Set(i+1, 0); Set(i+2, 1); j+=2; continue; } else if(broj[j]==0) { Set(i, 1); Set(i+1, 0); Set(i+2, 1); j+=2; continue; } else if(broj[j+1]==0) { Set(i, 1); Set(i+1, 1); Set(i+2, 0); j+=2; continue; } else { Set(i, 1); Set(i+1, 1); Set(i+2, 1); j+=2; continue; } } } }
#include "Brunolib.h" #include<bits/stdc++.h> #define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define dec(x, y) fixed << setprecision((y)) << (x) #define xx first #define yy second #define srt(v) sort((v).begin(), (v).end()) #define srtr(v) sort((v).rbegin(), (v).rend()) #define pb push_back #define popb pop_back #define sz(a) (int)(a).size() #define len(a) (int)(a).length() #define mp make_pair using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; ll Bruno(int N, int A[]) { ll x=0LL; for(int i=N-2; i>=0; i-=3) { int br=0; br+=A[i+2]; br*=2; br+=A[i+1]; br*=2; br+=A[i]; if(br==0) continue; else if(br==1) {x*=2LL; x+=1LL;} else if(br==2) {x*=2LL;} else if(br==3) {x*=4LL; x+=1LL;} else if(br==4) {x*=4LL;} else if(br==5) {x*=4LL; x+=2LL;} else if(br==6) {x*=2LL; x+=1LL;} else {x*=4LL; x+=3LL;} } return x; }
#Verdict Execution timeMemoryGrader output
Fetching results...