# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1077204 | kwongweng | Broken Device (JOI17_broken_device) | C++17 | 31 ms | 2724 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 vector<int> vi;
typedef long long ll;
typedef pair<int,int> ii;
#define FOR(i,a,b) for(int i=a; i<b; i++)
#define ROF(i,a,b) for(int i=a; i>=b; i--)
#define pb push_back
#define fi first
#define se second
void Anna( int N, long long X, int K, int P[] ){
vi pos(N); FOR(i,0,K) pos[P[i]]=1;
for( int i = 0; i < N/2; i++ ){
if (pos[2*i]==1 || pos[2*i+1]==1 || X==0){
Set(2*i,0); Set(2*i+1,0); continue;
}
if (X%3==0){
Set(2*i,0); Set(2*i+1,1);
}
if (X%3==1){
Set(2*i,1); Set(2*i+1,0);
}
if (X%3==2){
Set(2*i,1); Set(2*i+1,1);
}
X /= 3;
}
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> ii;
#define FOR(i,a,b) for(int i=a; i<b; i++)
#define ROF(i,a,b) for(int i=a; i>=b; i--)
#define pb push_back
#define fi first
#define se second
long long Bruno( int N, int A[] ){
ll val = 0; ll pos = 1;
FOR(i,0,N/2){
int id = A[i*2]*2 + A[i*2+1] - 1;
if (id==-1) continue;
val += id * pos; pos *= 3;
}
return val;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |