Submission #139773

#TimeUsernameProblemLanguageResultExecution timeMemory
139773dndhkBroken Device (JOI17_broken_device)C++14
100 / 100
44 ms3320 KiB
#include "Annalib.h" #include <bits/stdc++.h> #define pb push_back #define all(v) ((v).begin(), (v).end()) #define sortv(v) sort(all(v)) #define sz(v) ((int)(v).size()) #define uniqv(v) (v).erase(unique(all(v)), (v).end()) #define umax(a, b) (a)=max((a), (b)) #define umin(a, b) (a)=min((a), (b)) #define FOR(i,a,b) for(int i = (a); i <= (b); i++) #define rep(i,n) FOR(i,1,n) #define rep0(i,n) FOR(i,0,(int)(n)-1) #define FI first #define SE second #define INF 2000000000 #define INFLL 1000000000000000000LL using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAX_N = 150; int chk[MAX_N+1]; int ii=0; void S(int x, int y, int z){ Set(ii, x); Set(ii+1, y); Set(ii+2, z); ii+=3; } void Anna(int N, long long X, int K, int P[]){ ii = 0; for(int i=0; i<N; i++) chk[i] = false; for(int i=0; i<K; i++){ chk[P[i]] = 1; } int x = 0; for(int i = 0; i < N; i+=3){ if(chk[i] + chk[i+1] + chk[i+2] >= 2){ S(0, 0, 0); continue; } if(chk[i]+chk[i+1]+chk[i+2] == 1){ if(chk[i]){ if(X%2==1){ if(X%4==1){ S(0, 0, 1); }else{ S(0, 1, 1); } X/=(ll)4; }else{ S(0, 1, 0); X/=(ll)2; } }else if(chk[i+1]){ if(X%2==1){ S(1, 0, 0); }else{ S(1, 0, 1); } X/=(ll)2; }else{ if(X%2==1){ S(1, 0, 0); }else{ S(0, 1, 0); } X/=(ll)2; } }else{ if(X%4==0){ S(1, 1, 1); }else if(X%4==1){ S(0, 0, 1); }else if(X%4==2){ S(1, 1, 0); }else{ S(0, 1, 1); } X/=(ll)4; } } }
#include "Brunolib.h" #include <bits/stdc++.h> #define pb push_back #define all(v) ((v).begin(), (v).end()) #define sortv(v) sort(all(v)) #define sz(v) ((int)(v).size()) #define uniqv(v) (v).erase(unique(all(v)), (v).end()) #define umax(a, b) (a)=max((a), (b)) #define umin(a, b) (a)=min((a), (b)) #define FOR(i,a,b) for(int i = (a); i <= (b); i++) #define rep(i,n) FOR(i,1,n) #define rep0(i,n) FOR(i,0,(int)(n)-1) #define FI first #define SE second #define INF 2000000000 #define INFLL 1000000000000000000LL using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; ll ans = 0; ll two = 1; void make(int x, int y){ ans = ans + two * (int)x; two = two*(int)y; } long long Bruno( int N, int A[] ){ ans = 0; two = 1; for(int i=0; i<N; i+=3){ int k = A[i]*4 + A[i+1]*2 + A[i+2]; if(k==0) make(0, 1); else if(k==1) make(1, 4); else if(k==2) make(0, 2); else if(k==3) make(3, 4); else if(k==4) make(1, 2); else if(k==5) make(0, 2); else if(k==6) make(2, 4); else if(k==7) make(0, 4); } return ans; }

Compilation message (stderr)

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:41:6: warning: unused variable 'x' [-Wunused-variable]
  int x = 0;
      ^
#Verdict Execution timeMemoryGrader output
Fetching results...