Submission #990390

#TimeUsernameProblemLanguageResultExecution timeMemory
990390amine_arouaBroken Device (JOI17_broken_device)C++17
0 / 100
31 ms3276 KiB
#include "Annalib.h" #include<bits/stdc++.h> using namespace std; #define fore(i , n ) for(int i = 0 ; i < n; i++) void Anna( int N, long long X, int K, int P[] ) { srand(6661); vector<int> final(N); vector<bool> forbidden(N , 0); vector<int> seq(N); fore(i , N) seq[i] = i; random_shuffle(seq.begin() , seq.end()); fore(i , K) forbidden[P[i]] = 1; fore(i , N) { int cur = X%2; if(forbidden[seq[i]] == 1) continue; X/=2; if(cur == 0) final[seq[i]] = 0; else final[seq[i]] = 1; } fore(i , N) Set(i , final[i]); }
#include "Brunolib.h" #include <bits/stdc++.h> #define pb push_back #define Int long long #define fore(i , n ) for(int i = 0 ; i < n; i++) using namespace std; long long Bruno( int N, int A[] ){ srand(6661); vector<int> seq(N); fore(i , N) seq[i] = i; random_shuffle(seq.begin() , seq.end()); vector<int> po; fore(i , N) { if(A[seq[i]] == 1) po.pb(1); else po.pb(0); } reverse(po.begin() , po.end()); Int X = 0; for(auto x : po) X = 2*X + x; return X; }
#Verdict Execution timeMemoryGrader output
Fetching results...