답안 #231268

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
231268 2020-05-13T09:17:33 Z bensonlzl Broken Device (JOI17_broken_device) C++14
85 / 100
75 ms 3312 KB
#include <bits/stdc++.h>
#include "Annalib.h"

using namespace std;

typedef long long ll;

int usable[155], ans[155];

void Anna(int N, long long X, int K, int P[]){
	mt19937 rng(8537293);
	vector<int> v;
	for (int i = 0; i < N; ++i){
		usable[i] = 1;
		ans[i] = 0;
		v.push_back(i);
	}
	shuffle(v.begin(),v.end(),rng);
	for (int i = 0; i < K; ++i){
		usable[P[i]] = 0;
	}
	for (int i = 0; i < N; i += 2){
		if (usable[v[i]] && usable[v[i+1]]){
			if (X%3 == 0){
				ans[v[i]] = 0;
				ans[v[i+1]] = 1;
			}
			else if (X%3 == 1){
				ans[v[i]] = 1;
				ans[v[i+1]] = 0;
			}
			else{
				ans[v[i]] = 1;
				ans[v[i+1]] = 1;
			} 
			X /= 3;
		}
		else{
			ans[v[i]] = ans[v[i+1]] = 0;
		}
	}
	for (int i = 0; i < N; ++i){
		Set(i,ans[i]);
	}
}
#include <bits/stdc++.h>
#include "Annalib.h"

using namespace std;

typedef long long ll;

long long Bruno(int N, int A[]){
	mt19937 rng(8537293); 
	ll ans = 0;
	vector<int> v;
	for (int i = 0; i < N; ++i){
		v.push_back(i);
	}
	shuffle(v.begin(),v.end(),rng);
	ll coeff = 1;
	for (int i = 0; i < N; i += 2){
		if (A[v[i]] || A[v[i+1]]){
			if (A[v[i]] && !A[v[i+1]]){
				ans += 1*coeff;
			}
			else if (A[v[i]] && A[v[i+1]]){
				ans += 2*coeff;
			}
			coeff *= 3;
			if (coeff > 1e18) break;
		}
	}
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 64 ms 3056 KB Output is partially correct - L* = 39
2 Partially correct 63 ms 3056 KB Output is partially correct - L* = 38
3 Partially correct 67 ms 3056 KB Output is partially correct - L* = 39
4 Partially correct 63 ms 3056 KB Output is partially correct - L* = 38
5 Partially correct 63 ms 3056 KB Output is partially correct - L* = 39
6 Partially correct 68 ms 3072 KB Output is partially correct - L* = 38
7 Partially correct 64 ms 3072 KB Output is partially correct - L* = 39
8 Partially correct 64 ms 3056 KB Output is partially correct - L* = 39
9 Partially correct 63 ms 3032 KB Output is partially correct - L* = 39
10 Partially correct 64 ms 3056 KB Output is partially correct - L* = 39
11 Partially correct 65 ms 3072 KB Output is partially correct - L* = 39
12 Partially correct 67 ms 3056 KB Output is partially correct - L* = 38
13 Partially correct 64 ms 3056 KB Output is partially correct - L* = 39
14 Partially correct 63 ms 3072 KB Output is partially correct - L* = 38
15 Partially correct 64 ms 3056 KB Output is partially correct - L* = 39
16 Partially correct 64 ms 3056 KB Output is partially correct - L* = 38
17 Partially correct 63 ms 3056 KB Output is partially correct - L* = 39
18 Partially correct 64 ms 3056 KB Output is partially correct - L* = 39
19 Partially correct 63 ms 3056 KB Output is partially correct - L* = 39
20 Partially correct 63 ms 3056 KB Output is partially correct - L* = 39
21 Partially correct 65 ms 2984 KB Output is partially correct - L* = 38
22 Partially correct 64 ms 3120 KB Output is partially correct - L* = 39
23 Partially correct 62 ms 3056 KB Output is partially correct - L* = 38
24 Partially correct 72 ms 3056 KB Output is partially correct - L* = 39
25 Partially correct 63 ms 3056 KB Output is partially correct - L* = 38
26 Partially correct 63 ms 3056 KB Output is partially correct - L* = 39
27 Partially correct 62 ms 3072 KB Output is partially correct - L* = 38
28 Partially correct 69 ms 3056 KB Output is partially correct - L* = 38
29 Partially correct 64 ms 3056 KB Output is partially correct - L* = 38
30 Partially correct 63 ms 3056 KB Output is partially correct - L* = 38
31 Partially correct 64 ms 3056 KB Output is partially correct - L* = 38
32 Partially correct 75 ms 3312 KB Output is partially correct - L* = 39
33 Partially correct 65 ms 3056 KB Output is partially correct - L* = 39
34 Partially correct 64 ms 3072 KB Output is partially correct - L* = 39
35 Partially correct 65 ms 3056 KB Output is partially correct - L* = 39
36 Partially correct 72 ms 3056 KB Output is partially correct - L* = 39
37 Partially correct 65 ms 3072 KB Output is partially correct - L* = 38
38 Partially correct 66 ms 3072 KB Output is partially correct - L* = 39
39 Partially correct 64 ms 3056 KB Output is partially correct - L* = 39
40 Partially correct 63 ms 3056 KB Output is partially correct - L* = 37