Submission #139757

# Submission time Handle Problem Language Result Execution time Memory
139757 2019-08-01T11:13:29 Z dndhk Broken Device (JOI17_broken_device) C++14
0 / 100
43 ms 3408 KB
#include "Annalib.h"
#include <bits/stdc++.h>

#define pb push_back
#define all(v) ((v).begin(), (v).end())
#define sortv(v) sort(all(v))
#define sz(v) ((int)(v).size())
#define uniqv(v) (v).erase(unique(all(v)), (v).end())
#define umax(a, b) (a)=max((a), (b))
#define umin(a, b) (a)=min((a), (b))
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define rep(i,n) FOR(i,1,n)
#define rep0(i,n) FOR(i,0,(int)(n)-1)
#define FI first
#define SE second
#define INF 2000000000
#define INFLL 1000000000000000000LL


using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int MAX_N = 150;

int chk[MAX_N+1];

int ii=0;
void S(int x, int y, int z){
	Set(ii, x); Set(ii+1, y); Set(ii+2, z);
	ii+=3;
}

void Anna(int N, long long X, int K, int P[]){
	ii = 0;
	for(int i=0; i<N; i++)	chk[i] = false;
	for(int i=0; i<K; i++){
		chk[P[i]] = 1;
	}
	int x = 0;
	for(int i = 0; i < N; i+=3){
		if(chk[i] + chk[i+1] + chk[i+2] >= 2){
			S(0, 0, 0);
			continue;
		}
		if(chk[i]+chk[i+1]+chk[i+2] == 1){
			if(chk[i]){
				if(X%2==1){
					if(X%4==1){
						S(0, 0, 1);
					}else{
						S(0, 1, 1);
					}
					X/=(ll)4;
				}else{
					S(0, 1, 0);
					X/=(ll)2;
				}
			}else if(chk[i+1]){
				if(X%2==1){
					S(1, 0, 0);
				}else{
					S(1, 0, 1);
				}
				X/=(ll)2;
			}else{
				if(X%2==1){
					S(1, 0, 0);
				}else{
					S(0, 1, 0);	
				}	
				X/=(ll)2;
			}
		}else{
			if(X%4==0){
				S(1, 1, 1);
			}else if(X%4==1){
				S(0, 0, 1);
			}else if(X%4==2){
				S(1, 1, 0);
			}else{
				S(0, 1, 1);
			}
			X/=(ll)4;
		}
	}
}
#include "Brunolib.h"
#include <bits/stdc++.h>

#define pb push_back
#define all(v) ((v).begin(), (v).end())
#define sortv(v) sort(all(v))
#define sz(v) ((int)(v).size())
#define uniqv(v) (v).erase(unique(all(v)), (v).end())
#define umax(a, b) (a)=max((a), (b))
#define umin(a, b) (a)=min((a), (b))
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define rep(i,n) FOR(i,1,n)
#define rep0(i,n) FOR(i,0,(int)(n)-1)
#define FI first
#define SE second
#define INF 2000000000
#define INFLL 1000000000000000000LL


using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;


ll ans = 0;
ll two = 1;

void make(ll x, ll y){
	ans = ans + two * x;
	two = two*y;
}

long long Bruno( int N, int A[] ){
	ans = 0; two = 1;
	for(int i=0; i<N; i+=3){
		int k = A[i]*4 + A[i+1]*2 + A[i+2];
		if(k==0)	make(0, 1);
		else if(k==1)	make(1, 4);
		else if(k==2)	make(0, 2);
		else if(k==3)	make(3, 4);
		else if(k==4)	make(1, 2);
		else if(k==5)	make(0, 1);
		else if(k==6)	make(2, 4);
		else if(k==7)	make(0, 4);
	}
	//cout<<ans;
	return ans;
}

Compilation message

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:41:6: warning: unused variable 'x' [-Wunused-variable]
  int x = 0;
      ^
# Verdict Execution time Memory Grader output
1 Incorrect 40 ms 3312 KB Output isn't correct - L* = 0
2 Incorrect 40 ms 3312 KB Output isn't correct - L* = 0
3 Incorrect 40 ms 3312 KB Output isn't correct - L* = 0
4 Incorrect 40 ms 3312 KB Output isn't correct - L* = 0
5 Incorrect 40 ms 3312 KB Output isn't correct - L* = 0
6 Incorrect 41 ms 3312 KB Output isn't correct - L* = 0
7 Incorrect 40 ms 3312 KB Output isn't correct - L* = 0
8 Incorrect 41 ms 3272 KB Output isn't correct - L* = 0
9 Incorrect 40 ms 3256 KB Output isn't correct - L* = 0
10 Incorrect 41 ms 3312 KB Output isn't correct - L* = 0
11 Incorrect 41 ms 3312 KB Output isn't correct - L* = 0
12 Incorrect 41 ms 3408 KB Output isn't correct - L* = 0
13 Incorrect 41 ms 3160 KB Output isn't correct - L* = 0
14 Incorrect 40 ms 3256 KB Output isn't correct - L* = 0
15 Incorrect 41 ms 3312 KB Output isn't correct - L* = 0
16 Incorrect 40 ms 3312 KB Output isn't correct - L* = 0
17 Incorrect 41 ms 3184 KB Output isn't correct - L* = 0
18 Incorrect 40 ms 3208 KB Output isn't correct - L* = 0
19 Incorrect 40 ms 3408 KB Output isn't correct - L* = 0
20 Incorrect 40 ms 3256 KB Output isn't correct - L* = 0
21 Incorrect 41 ms 3312 KB Output isn't correct - L* = 0
22 Incorrect 40 ms 3312 KB Output isn't correct - L* = 0
23 Incorrect 43 ms 3312 KB Output isn't correct - L* = 0
24 Incorrect 41 ms 3312 KB Output isn't correct - L* = 0
25 Incorrect 43 ms 3152 KB Output isn't correct - L* = 0
26 Incorrect 43 ms 3312 KB Output isn't correct - L* = 0
27 Incorrect 41 ms 3264 KB Output isn't correct - L* = 0
28 Incorrect 41 ms 3056 KB Output isn't correct - L* = 0
29 Incorrect 40 ms 3304 KB Output isn't correct - L* = 0
30 Incorrect 40 ms 3312 KB Output isn't correct - L* = 0
31 Incorrect 41 ms 3240 KB Output isn't correct - L* = 0
32 Incorrect 41 ms 3312 KB Output isn't correct - L* = 0
33 Incorrect 41 ms 3312 KB Output isn't correct - L* = 0
34 Incorrect 41 ms 3312 KB Output isn't correct - L* = 0
35 Incorrect 41 ms 3312 KB Output isn't correct - L* = 0
36 Incorrect 43 ms 3312 KB Output isn't correct - L* = 0
37 Incorrect 43 ms 3312 KB Output isn't correct - L* = 0
38 Incorrect 41 ms 3312 KB Output isn't correct - L* = 0
39 Incorrect 41 ms 3056 KB Output isn't correct - L* = 0
40 Incorrect 41 ms 3312 KB Output isn't correct - L* = 0