# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1208426 | mychecksedad | Broken Device (JOI17_broken_device) | C++20 | 28 ms | 1556 KiB |
/* Author : Mychecksdead */
#include<bits/stdc++.h>
#include "Annalib.h"
using namespace std;
#define ll long long int
#define MOD (1000000000+7)
#define MOD1 (998244353)
#define pb push_back
#define all(x) x.begin(), x.end()
#define en cout << '\n'
#define ff first
#define ss second
#define pii pair<int,int>
#define vi vector<int>
const int N = 1e6+100, M = 1e5+10, K = 52, MX = 30;
const ll fix = 96118017089905827;
void Anna( int n, long long X, int k, int p[] ){
X ^= fix;
vector<bool> good(n, 1);
for(int i = 0; i < k; ++i) good[p[i]] = 0;
vi bits;
while(X){
bits.pb(X%2);
X /= 2;
}
for(int i = 1; i < n; i += 2){
if((good[i] == 0 && good[i - 1] == 0) || bits.empty()){// just bad or finished
Set(i, 0);
Set(i - 1, 0);
continue;
}
if(good[i] == 0){ // right faulty
if(bits.back() == 1){
Set(i, 0);
Set(i - 1, 1);
bits.pop_back();
}else{
Set(i, 0);
Set(i - 1, 0);
}
}else if(good[i - 1] == 0){ // left faulty
if(bits.back()){
Set(i, 1);
Set(i - 1, 0);
bits.pop_back();
}else{
Set(i, 0);
Set(i - 1, 0);
}
}else{
if(bits.back()){
Set(i, 0);
Set(i - 1, 1);
}else{
Set(i, 1);
Set(i - 1, 1);
}
bits.pop_back();
}
}
}
#include<bits/stdc++.h>
#include "Brunolib.h"
using namespace std;
#define ll long long int
#define MOD (1000000000+7)
#define MOD1 (998244353)
#define pb push_back
#define all(x) x.begin(), x.end()
#define en cout << '\n'
#define ff first
#define ss second
#define pii pair<int,int>
#define vi vector<int>
const int N = 1e6+100, M = 1e5+10, K = 52, MX = 30;
const ll fix = 96118017089905827;
long long Bruno( int n, int a[] ){
ll ans = 0;
vi v;
for(int i = 1; i < n; i += 2){
if(a[i] || a[i - 1]){
v.pb(a[i] ^ a[i - 1]);
}
}
for(int b: v){
ans *= 2;
ans += b;
}
return ans ^ fix;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |