Submission #959170

#TimeUsernameProblemLanguageResultExecution timeMemory
959170AbitoBroken Device (JOI17_broken_device)C++17
41 / 100
31 ms2868 KiB
#include "Annalib.h" #include <bits/stdc++.h> using namespace std; bool vis[155]; int t1=2125252; void Anna( int n, long long X, int k, int p[] ){ memset(vis,0,sizeof(vis)); long long j=0; t1++; srand(t1); int x=rand()%2; //cout<<x<<endl; for (int i=0;i<k;i++) vis[p[i]]=1; if (x){ for (int i=0;i<n;i+=2){ if ((vis[i] && vis[i+1]) || j>=60LL){ Set(i,0); Set(i+1,0); continue; } if ((X&(1LL<<j)) && vis[i+1]){ Set(i,0); Set(i+1,0); continue; } if (X&(1LL<<j)){ Set(i,0); Set(i+1,1); j++; continue; } if (!(X&(1LL<<j)) && vis[i]){ Set(i,0); Set(i+1,0); continue; } Set(i,1); Set(i+1,0); j++; }return;} for (int i=0;i<n;i+=2){ if ((vis[i] && vis[i+1]) || j>=60LL){ Set(i,0); Set(i+1,0); continue; } if ((X&(1LL<<j)) && vis[i]){ Set(i,0); Set(i+1,0); continue; } if (X&(1LL<<j)){ Set(i,1); Set(i+1,0); j++; continue; } if (!(X&(1LL<<j)) && vis[i+1]){ Set(i,0); Set(i+1,0); continue; } Set(i,0); Set(i+1,1); j++; }return; }
#include "Brunolib.h" #include <bits/stdc++.h> using namespace std; int t2=2125252; long long Bruno( int n, int a[] ){ //for (int i=0;i<n;i++) cout<<a[i]<<' ';cout<<endl; t2++; srand(t2); int x=rand()%2; //cout<<x<<endl; long long X=0,j=0; if (x){ for (int i=0;i<n;i+=2){ if (!a[i] && !a[i+1]) continue; if (a[i+1]) X|=(1LL<<j); j++; } return X;} for (int i=0;i<n;i+=2){ if (!a[i] && !a[i+1]) continue; if (a[i]) X|=(1LL<<j); j++; }return X; }
#Verdict Execution timeMemoryGrader output
Fetching results...