답안 #100913

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
100913 2019-03-15T06:16:05 Z Pro_ktmr Broken Device (JOI17_broken_device) C++14
85 / 100
61 ms 3112 KB
#include"bits/stdc++.h"
using namespace std;
#define LL long long
#define MP make_pair
#include"Annalib.h"

static vector<int> keta(LL X, int i){
	vector<int> re;
	while(X > 0){
		re.push_back(X%i);
		X /= i;
	}
	return re;
}

static LL make(vector<int> v, int i){
	LL re = 0;
	for(int j=v.size()-1; j>=0; j--){
		re *= i;
		re += v[j];
	}
	return re;
}

//void Set(int pos, int bit)
//N=150
void Anna(int N, long long X, int K, int P[]){
	bool canUse[150];
	for(int i=0; i<N; i++) canUse[i] = true;
	for(int i=0; i<K; i++) canUse[P[i]] = false;
	vector<int> tmp = keta(X, 3);
	LL now = 0;
	for(int i=0; i+1<N; i+=2){
		if(now < tmp.size() && canUse[i] && canUse[i+1]){
			if(tmp[now] == 0){
				Set(i, 0);
				Set(i+1, 1);
			}
			if(tmp[now] == 1){
				Set(i, 1);
				Set(i+1, 0);
			}
			if(tmp[now] == 2){
				Set(i, 1);
				Set(i+1, 1);
			}
			now++;
		}
		else{
			Set(i, 0);
			Set(i+1, 0);
		}
	}
}
#include"bits/stdc++.h"
using namespace std;
#define LL long long
#define MP make_pair
#include"Brunolib.h"

static vector<int> keta(LL X, int i){
	vector<int> re;
	while(X > 0){
		re.push_back(X%i);
		X /= i;
	}
	return re;
}

static LL make(vector<int> v, int i){
	LL re = 0;
	for(int j=v.size()-1; j>=0; j--){
		re *= i;
		re += v[j];
	}
	return re;
}

long long Bruno(int N, int A[]){
	vector<int> ans;
	for(int i=0; i+1<N; i+=2){
		if(A[i] == 0 && A[i+1] == 1){
			ans.push_back(0);
		}
		if(A[i] == 1 && A[i+1] == 0){
			ans.push_back(1);
		}
		if(A[i] == 1 && A[i+1] == 1){
			ans.push_back(2);
		}
	}
	return make(ans,3);
}

Compilation message

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:34:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if(now < tmp.size() && canUse[i] && canUse[i+1]){
      ~~~~^~~~~~~~~~~~
Anna.cpp: At global scope:
Anna.cpp:16:11: warning: 'long long int make(std::vector<int>, int)' defined but not used [-Wunused-function]
 static LL make(vector<int> v, int i){
           ^~~~

Bruno.cpp:7:20: warning: 'std::vector<int> keta(long long int, int)' defined but not used [-Wunused-function]
 static vector<int> keta(LL X, int i){
                    ^~~~
# 결과 실행 시간 메모리 Grader output
1 Partially correct 36 ms 3056 KB Output is partially correct - L* = 37
2 Partially correct 40 ms 3056 KB Output is partially correct - L* = 37
3 Partially correct 48 ms 3072 KB Output is partially correct - L* = 37
4 Partially correct 39 ms 3072 KB Output is partially correct - L* = 37
5 Partially correct 44 ms 3072 KB Output is partially correct - L* = 37
6 Partially correct 43 ms 3072 KB Output is partially correct - L* = 37
7 Partially correct 40 ms 2912 KB Output is partially correct - L* = 37
8 Partially correct 56 ms 3000 KB Output is partially correct - L* = 37
9 Partially correct 49 ms 3000 KB Output is partially correct - L* = 37
10 Partially correct 57 ms 3056 KB Output is partially correct - L* = 37
11 Partially correct 61 ms 3056 KB Output is partially correct - L* = 37
12 Partially correct 47 ms 3056 KB Output is partially correct - L* = 37
13 Partially correct 54 ms 3056 KB Output is partially correct - L* = 37
14 Partially correct 57 ms 3072 KB Output is partially correct - L* = 37
15 Partially correct 52 ms 3056 KB Output is partially correct - L* = 37
16 Partially correct 40 ms 3064 KB Output is partially correct - L* = 37
17 Partially correct 57 ms 3056 KB Output is partially correct - L* = 37
18 Partially correct 48 ms 3056 KB Output is partially correct - L* = 37
19 Partially correct 51 ms 3056 KB Output is partially correct - L* = 37
20 Partially correct 44 ms 3008 KB Output is partially correct - L* = 37
21 Partially correct 49 ms 3072 KB Output is partially correct - L* = 37
22 Partially correct 46 ms 2904 KB Output is partially correct - L* = 37
23 Partially correct 51 ms 3072 KB Output is partially correct - L* = 37
24 Partially correct 40 ms 3016 KB Output is partially correct - L* = 37
25 Partially correct 55 ms 3072 KB Output is partially correct - L* = 37
26 Partially correct 41 ms 3056 KB Output is partially correct - L* = 37
27 Partially correct 38 ms 3072 KB Output is partially correct - L* = 37
28 Partially correct 45 ms 3056 KB Output is partially correct - L* = 37
29 Partially correct 54 ms 3056 KB Output is partially correct - L* = 37
30 Partially correct 49 ms 3112 KB Output is partially correct - L* = 37
31 Partially correct 38 ms 3040 KB Output is partially correct - L* = 37
32 Partially correct 44 ms 3056 KB Output is partially correct - L* = 37
33 Partially correct 39 ms 3056 KB Output is partially correct - L* = 37
34 Partially correct 50 ms 3056 KB Output is partially correct - L* = 37
35 Partially correct 47 ms 3056 KB Output is partially correct - L* = 37
36 Partially correct 39 ms 3072 KB Output is partially correct - L* = 37
37 Partially correct 40 ms 3072 KB Output is partially correct - L* = 37
38 Partially correct 52 ms 3072 KB Output is partially correct - L* = 37
39 Partially correct 49 ms 3072 KB Output is partially correct - L* = 37
40 Partially correct 41 ms 3056 KB Output is partially correct - L* = 37