# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
999477 | jcelin | Broken Device (JOI17_broken_device) | C++14 | 39 ms | 2852 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<bits/stdc++.h>
#include "Annalib.h"
using namespace std;
typedef vector<int> vi;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
#define PB push_back
#define PPB pop_back
#define X first
#define Y second
#define all(x) (x).begin(), (x).end()
/*
int niz[300], ret[300];
void Set(int x, int y){
if(!del[x]) ret[x] = y;
}
*/
void Anna(int n, ll x, int k, int* p){
srand(19719);
vi pos, del(151, 0);
pos.clear();
for(int i=0; i<n; i++) pos.PB(i);
random_shuffle(all(pos));
for(int i=0; i<k; i++) del[p[i]] = 1;
for(int i=0; i<75; i++){
int cr = x % 3;
int a = pos[i * 2];
int b = pos[i * 2 + 1];
if(cr == 0 and !del[b]){
Set(a, 0);
Set(b, 1);
}else if(cr == 1 and !del[a]){
Set(a, 1);
Set(b, 0);
}else if(cr == 2 and !del[a] and !del[b]){
Set(a, 1);
Set(b, 1);
}else{
Set(a, 0);
Set(b, 0);
continue;
}
x /= 3;
}
}
/*
int main(){
int n, k;
ll x;
cin >> n >> x >> k;
for(int i=0; i<k; i++) cin >> niz[i];
Anna(150, x, k, niz);
for(int i=0; i<150; i++) cout << ret[i];
cout << "\n";
return 0;
}
*/
#include<bits/stdc++.h>
#include "Brunolib.h"
using namespace std;
typedef vector<int> vi;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
#define PB push_back
#define PPB pop_back
#define X first
#define Y second
#define all(x) (x).begin(), (x).end()
int niz[300];
ll Bruno(int n, int* p){
srand(19719);
vi pos, ret;
for(int i=0; i<n; i++) pos.PB(i);
random_shuffle(all(pos));
for(int i=0; i<75; i++){
int a = pos[i * 2];
int b = pos[i * 2 + 1];
int vl = p[a] * 2 + p[b];
if(vl == 0) continue;
ret.PB(vl - 1);
}
reverse(all(ret));
ll ans = 0;
for(auto &x : ret) ans *= (ll)3, ans += (ll)x;
return ans;
}
/*
int main(){
for(int i=0; i<150; i++){
char x;
cin >> x;
niz[i] = x - '0';
}
cout << Bruno(150, niz) << "\n";
return 0;
}
*/
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |