# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
67071 | reality | Broken Device (JOI17_broken_device) | C++17 | 72 ms | 4072 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;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define mp make_pair
#define db long double
#define pb push_back
#define all(s) s.begin(),s.end()
template < class P , class Q > ostream& operator<<(ostream& stream, pair < P , Q > v){ stream << "(" << v.fi << ',' << v.se << ")"; return stream;}
template < class T > ostream& operator<<(ostream& stream, const vector<T> v){ stream << "[ "; for (int i=0; i<(int)v.size(); i++) stream << v[i] << " "; stream << "]"; return stream;}
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
const int NN = 256;
int st[NN];
const int A[] = {1,2,2,4,4,4,2,4};
const int B[] = {0,0,1,2,3,1,0,0};
void Anna(int N,ll X,int K,int P[]) {
int n = N;
for (int i = 0;i < N;++i)
st[i] = 0;
for (int i = 0;i < K;++i)
st[P[i]] = 1;
for (int i = 0;i < N;i += 3) {
int bl = st[i] + st[i + 1] * 2 + st[i + 2] * 4;
int mask = 0;
for (int j = 1;j < 8;++j) {
if (j & bl)
continue;
if (!(j & bl) && (X & (A[j] - 1)) == B[j]) {
if (A[mask] < A[j])
mask = j;
}
}
for (int j = 0;j < 3;++j)
Set(i + j,(mask >> j) & 1);
X /= A[mask];
}
}
#include "Brunolib.h"
#include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define vii vector < pii >
#define mp make_pair
#define db long double
#define pb push_back
#define all(s) s.begin(),s.end()
template < class P , class Q > ostream& operator<<(ostream& stream, pair < P , Q > v){ stream << "(" << v.fi << ',' << v.se << ")"; return stream;}
template < class T > ostream& operator<<(ostream& stream, const vector<T> v){ stream << "[ "; for (int i=0; i<(int)v.size(); i++) stream << v[i] << " "; stream << "]"; return stream;}
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
const int A[] = {1,2,2,4,4,4,2,4};
const int B[] = {0,0,1,2,3,1,0,0};
long long Bruno( int N, int S[] ){
int n = N;
ll ans = 0;
ll was = 1;
for (int i = 0;i < N;i += 3) {
int cnt = S[i] + S[i + 1] * 2 + S[i + 2] * 4;
ans += was * B[cnt];
was *= A[cnt];
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |