Submission #852157

#TimeUsernameProblemLanguageResultExecution timeMemory
852157Rafi22Broken Device (JOI17_broken_device)C++14
85 / 100
38 ms2820 KiB
#include <bits/stdc++.h> #include "Annalib.h" #define ll long long #define ld long double #define endl '\n' #define st first #define nd second #define pb push_back #define sz(x) (int)(x).size() #define all(x) (x).begin(), (x).end() using namespace std; //int inf=1000000007; //int mod=1000000007; //int mod1=998244353; bool bad[157]; int res[157]; void Anna(int n,ll x,int k,int P[]) { srand(213769); vector<int>ord; for(int i=0;i<150;i++) ord.pb(i); random_shuffle(all(ord)); for(int i=0;i<150;i++) { res[i]=0; bad[i]=0; } for(int i=0;i<k;i++) bad[P[i]]=1; for(int i=0;i<150;i+=2) { if(bad[ord[i]]||bad[ord[i+1]]) continue; if(x%3==0||x%3==2) res[ord[i]]=1; if(x%3==1||x%3==2) res[ord[i+1]]=1; x/=3; } for(int i=0;i<150;i++) Set(i,res[i]); }
#include <bits/stdc++.h> #include "Brunolib.h" #define ll long long #define ld long double #define endl '\n' #define st first #define nd second #define pb push_back #define sz(x) (int)(x).size() #define all(x) (x).begin(), (x).end() using namespace std; //int inf=1000000007; //int mod=1000000007; //int mod1=998244353; ll Bruno(int n,int a[]) { srand(213769); vector<int>ord; for(int i=0;i<150;i++) ord.pb(i); random_shuffle(all(ord)); ll wyn=0,p=1; for(int i=0;i<150;i+=2) { if(a[ord[i]]==0&&a[ord[i+1]]==0) continue; if(a[ord[i]]==0&&a[ord[i+1]]==1) wyn+=p; if(a[ord[i]]==1&&a[ord[i+1]]==1) wyn+=2*p; p*=3; } return wyn; }
#Verdict Execution timeMemoryGrader output
Fetching results...