제출 #1262023

#제출 시각아이디문제언어결과실행 시간메모리
1262023Szymon_PilipczukBroken Device (JOI17_broken_device)C++20
51 / 100
20 ms1572 KiB
#include "Annalib.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define st first #define nd second #define pb push_back #define all(a) a.begin(),a.end() #define rep(a,b) for(int a = 0;a<b;a++) const int inf = 1e9; const ll infl = 1e18; void Anna(int n, ll x,int k,int p[]) { int i =0; int j = 0; while(i < n) { if((j == k || p[j] > i+2) && i < n-2) { Set(i,1); Set(i+1,x%2); x/=2; Set(i+2,x%2); x/=2; i+=3; } else { if(p[j] == i) { j++; } Set(i,0); i++; } } }
#include "Brunolib.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define st first #define nd second #define pb push_back #define all(a) a.begin(),a.end() #define rep(a,b) for(int a = 0;a<b;a++) const int inf = 1e9; const ll infl = 1e18; ll Bruno(int n,int a[]) { /*p(i,n) { cerr<<a[i]<<" "; } cerr<<"\n";*/ int j = 0; ll ans = 0; int i = 0; while(i < n) { if(a[i] == 1) { ans += (1LL<<j) * a[i+1]; // cerr<<(1LL<<j) * a[i+1]<<" "<<a[i+1]<<" "<<(1LL<<j)<<"\n"; j++; ans += (1LL<<j) * a[i+2]; //cerr<<(1LL<<j) * a[i+2]<<" "<<a[i+2]<<" "<<(1LL<<j)<<"\n"; j++; i+=3; } else { i++; } } cerr<<ans<<"\n"; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...