답안 #231888

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
231888 2020-05-15T08:45:38 Z jiahng Broken Device (JOI17_broken_device) C++14
0 / 100
10 ms 1044 KB
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)
#define maxn 151

bool broken[maxn];

void Anna(int N, long long X, int K, int P[]){
	FOR(i,0,K-1) broken[P[i]] = 1;
	int idx = 0;
	
	for (int i = 0; i < 150; i += 3){
		int num = 0;
		bool A[3];
		
		FOR(j,i,i+2) if (broken[j]){
			A[j-i] = 1;
			num++;
		}
		
		if (num > 1){
			FOR(j,i,i+1) Set(j,0);
			continue;
		}else if (num == 1){
			if (X & (1<<idx)){
				if (!A[2]){
					Set(i,0); Set(i+1,0); Set(i+2,1);
				}else{
					Set(i,1); Set(i+1,1); Set(i+2,0);
				}
				idx++;
			}else{
				if (!A[1]){
					Set(i,0); Set(i+1,1); Set(i+2,0);
					idx++;
				}else{
					if (X & (1<<(idx+1))){
						Set(i,0); Set(i+1,0); Set(i+2,1);
					}else{
						Set(i,1); Set(i+1,0); Set(i+2,1);
					}
					idx += 2;
				}
			}
		}else{
			string a = "";
			if (X & (1<<idx)) a += '1';
			else a += '0';
			
			if (X & (1<<(idx+1))) a += '1';
			else a += '0';
			
			if (a == "00"){
				Set(i,1); Set(i+1,0); Set(i+2,1);
			}else if (a == "01"){
				Set(i,1); Set(i+1,0); Set(i+2,0);
			}else if (a == "10"){
				Set(i,0); Set(i+1,1); Set(i+2,1);
			}else{
				Set(i,1); Set(i+1,1); Set(i+2,1);
			}
			idx += 2;
		}
	}
			
		  
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)


long long Bruno(int N, int A[]){
  string ans = "";
  
  for (int i = 0; i < 150; i+=3){
	  string cur = "";
	  FOR(j,i,i+2){
		  if (A[j] == 1) cur += '1';
		  else cur += '0';
	  }
	  
	  if (cur == "000") continue;
	  else if (cur == "001" || cur == "110") ans += '1';
	  else if (cur == "010") ans += '0';
	  else if (cur == "111") ans += "11";
	  else if (cur == "011") ans += "10";
	  else if (cur == "100") ans += "01";
	  else ans += "00";
  }
  
  ll lans = 0;
  
  FOR(i,0,ans.size() - 1){
	  if (ans[i] == '1') lans |= (1<<i);
  }
  return lans;
  
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 9 ms 916 KB Wrong Answer [4]
2 Incorrect 8 ms 900 KB Wrong Answer [4]
3 Incorrect 10 ms 884 KB Wrong Answer [4]
4 Incorrect 9 ms 1024 KB Wrong Answer [4]
5 Incorrect 10 ms 1036 KB Wrong Answer [4]
6 Incorrect 9 ms 796 KB Wrong Answer [4]
7 Incorrect 9 ms 948 KB Wrong Answer [4]
8 Incorrect 10 ms 1008 KB Wrong Answer [4]
9 Incorrect 8 ms 788 KB Wrong Answer [4]
10 Incorrect 9 ms 1040 KB Wrong Answer [4]
11 Incorrect 8 ms 1036 KB Wrong Answer [4]
12 Incorrect 10 ms 880 KB Wrong Answer [4]
13 Incorrect 10 ms 1036 KB Wrong Answer [4]
14 Incorrect 8 ms 764 KB Wrong Answer [4]
15 Incorrect 9 ms 1044 KB Wrong Answer [4]
16 Incorrect 9 ms 796 KB Wrong Answer [4]
17 Incorrect 10 ms 1032 KB Wrong Answer [4]
18 Incorrect 9 ms 1044 KB Wrong Answer [4]
19 Incorrect 9 ms 916 KB Wrong Answer [4]
20 Incorrect 9 ms 1028 KB Wrong Answer [4]
21 Incorrect 9 ms 1040 KB Wrong Answer [4]
22 Incorrect 8 ms 1032 KB Wrong Answer [4]
23 Incorrect 9 ms 916 KB Wrong Answer [4]
24 Incorrect 10 ms 1008 KB Wrong Answer [4]
25 Incorrect 9 ms 1044 KB Wrong Answer [4]
26 Incorrect 9 ms 1032 KB Wrong Answer [4]
27 Incorrect 9 ms 788 KB Wrong Answer [4]
28 Incorrect 9 ms 916 KB Wrong Answer [4]
29 Incorrect 8 ms 1040 KB Wrong Answer [4]
30 Incorrect 9 ms 916 KB Wrong Answer [4]
31 Incorrect 10 ms 1028 KB Wrong Answer [4]
32 Incorrect 9 ms 1036 KB Wrong Answer [4]
33 Incorrect 8 ms 1020 KB Wrong Answer [4]
34 Incorrect 9 ms 1044 KB Wrong Answer [4]
35 Incorrect 9 ms 904 KB Wrong Answer [4]
36 Incorrect 9 ms 916 KB Wrong Answer [4]
37 Incorrect 8 ms 1032 KB Wrong Answer [4]
38 Incorrect 8 ms 788 KB Wrong Answer [4]
39 Incorrect 9 ms 1016 KB Wrong Answer [4]
40 Incorrect 10 ms 1040 KB Wrong Answer [4]