# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
999133 | AdamGS | Broken Device (JOI17_broken_device) | C++17 | 37 ms | 2888 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "Annalib.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
void Anna(int n, ll x, int k, int P[]) {
vector<ll>A={-1, 0, 1, 2, 0, 1, 1, 3}, B={-1, 4, 2, 4, 2, 2, 4, 4};
vector<int>czy(n), T(n);
rep(i, k) czy[P[i]]=1;
ll akt=0;
for(int i=0; i<n; i+=3) {
int s=czy[i]+czy[i+1]+czy[i+2];
if(s>=2) continue;
ll a=x%4;
bool ok=false;
rep(j, 8) if(A[j]==a && B[j]==4) {
bool ok2=true;
rep(l, 3) if(czy[i+l] && (j&(1<<l))) ok2=false;
if(!ok2) continue;
rep(l, 3) if(j&(1<<l)) T[i+l]=1;
ok=true;
x/=4;
break;
}
if(ok) continue;
a=x%2;
rep(j, 8) if(A[j]==a && B[j]==2) {
bool ok2=true;
rep(l, 3) if(czy[i+l] && (j&(1<<l))) ok2=false;
if(!ok2) continue;
rep(l, 3) if(j&(1<<l)) T[i+l]=1;
ok=true;
x/=2;
break;
}
}
rep(i, n) Set(i, T[i]);
}
#include "Brunolib.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
ll Bruno(int n, int T[]) {
vector<ll>A={-1, 0, 1, 2, 0, 1, 1, 3}, B={-1, 4, 2, 4, 2, 2, 4, 4};
ll x=0, p=1;
for(int i=0; i<n; i+=3) {
if(T[i]+T[i+1]+T[i+2]==0) continue;
ll c=T[i]+2*T[i+1]+4*T[i+2];
x+=p*A[c];
p*=B[c];
}
return x;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |