답안 #131718

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
131718 2019-07-17T13:20:49 Z Mahmoud_Adel Broken Device (JOI17_broken_device) C++14
85 / 100
61 ms 3088 KB
#include <bits/stdc++.h>
#include "Annalib.h"
typedef long long ll;
using namespace std;
int mark[151];
ll power(ll x, ll y)
{
	if(y == 0) return 1;
	ll ret = 1;
	while(y--) ret *= x;
	return ret;
}
void Anna(int n, long long x, int k, int p[] )
{
	srand(444);
	vector<int> v;
	for(int i=0; i<150; i++) v.push_back(i);
	random_shuffle(v.begin(), v.end());
	ll temp = x, cnt = 0;
	memset(mark, 0, sizeof mark);
	for(int i=0; i<k; i++) mark[p[i]] = 1;
	ll a[38];
	for(ll i=37; i>=0; i--)
	{
		if(temp >= power(3, i)*2) temp -= power(3, i)*2, a[i] = 2;
		else if(temp >= power(3, i)) temp -= power(3, i), a[i] = 1;
		else a[i] = 0;
	}
	for(int i=0; i<n; i+=2)
	{
		if(mark[v[i]] || mark[v[i+1]] || cnt > 37) Set(v[i], 0), Set(v[i+1], 0);
		else
		{
			if(a[cnt] == 2) Set(v[i], 1), Set(v[i+1], 1);
			else if(a[cnt] == 1) Set(v[i], 1), Set(v[i+1], 0);
			else Set(v[i], 0), Set(v[i+1], 1);
			cnt++;
		}
	}
}
#include "Brunolib.h"
#include <bits/stdc++.h>
//~ #include "Anna.cpp"
//~ #include "grader.cpp"
typedef long long ll;
using namespace std;
ll power(ll x, ll y)
{
	if(y == 0) return 1;
	ll ret = 1;
	while(y--) ret *= x;
	return ret;
}
long long Bruno(int n, int a[] )
{
	srand(444);
	srand(444);
	vector<int> v;
	for(int i=0; i<150; i++) v.push_back(i);
	random_shuffle(v.begin(), v.end());
	ll cnt = 0;
	ll x = 0;
	for(int i=0; i<n; i+=2)
	{
		if(!a[v[i]] && !a[v[i+1]]) continue;
		int b;
		if(a[v[i]] == 1 && a[v[i+1]] == 1) b = 2;
		else if(a[v[i]] == 1) b = 1;
		else b = 0;
		x += b*power(3, cnt++);
	}
	return x;
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 61 ms 3000 KB Output is partially correct - L* = 37
2 Correct 59 ms 3056 KB Output is correct - L* = 40
3 Partially correct 59 ms 2904 KB Output is partially correct - L* = 39
4 Partially correct 60 ms 2816 KB Output is partially correct - L* = 38
5 Partially correct 59 ms 2896 KB Output is partially correct - L* = 38
6 Partially correct 60 ms 3056 KB Output is partially correct - L* = 39
7 Partially correct 59 ms 3072 KB Output is partially correct - L* = 39
8 Partially correct 59 ms 2856 KB Output is partially correct - L* = 38
9 Partially correct 59 ms 3064 KB Output is partially correct - L* = 39
10 Partially correct 59 ms 3056 KB Output is partially correct - L* = 39
11 Partially correct 59 ms 2872 KB Output is partially correct - L* = 38
12 Partially correct 60 ms 3056 KB Output is partially correct - L* = 39
13 Partially correct 59 ms 3016 KB Output is partially correct - L* = 38
14 Partially correct 59 ms 3056 KB Output is partially correct - L* = 38
15 Partially correct 59 ms 2888 KB Output is partially correct - L* = 39
16 Partially correct 59 ms 2936 KB Output is partially correct - L* = 39
17 Partially correct 61 ms 3016 KB Output is partially correct - L* = 39
18 Partially correct 59 ms 2952 KB Output is partially correct - L* = 38
19 Partially correct 59 ms 3040 KB Output is partially correct - L* = 39
20 Partially correct 60 ms 2840 KB Output is partially correct - L* = 39
21 Partially correct 59 ms 2888 KB Output is partially correct - L* = 38
22 Partially correct 59 ms 3080 KB Output is partially correct - L* = 39
23 Partially correct 59 ms 3088 KB Output is partially correct - L* = 39
24 Partially correct 59 ms 3064 KB Output is partially correct - L* = 38
25 Partially correct 60 ms 3056 KB Output is partially correct - L* = 38
26 Partially correct 59 ms 3056 KB Output is partially correct - L* = 39
27 Partially correct 59 ms 3064 KB Output is partially correct - L* = 39
28 Partially correct 59 ms 3056 KB Output is partially correct - L* = 38
29 Partially correct 59 ms 3056 KB Output is partially correct - L* = 39
30 Partially correct 59 ms 3056 KB Output is partially correct - L* = 39
31 Partially correct 59 ms 3056 KB Output is partially correct - L* = 37
32 Partially correct 59 ms 3064 KB Output is partially correct - L* = 37
33 Partially correct 59 ms 2904 KB Output is partially correct - L* = 39
34 Partially correct 59 ms 2928 KB Output is partially correct - L* = 39
35 Partially correct 59 ms 3056 KB Output is partially correct - L* = 38
36 Partially correct 59 ms 2976 KB Output is partially correct - L* = 39
37 Partially correct 60 ms 3056 KB Output is partially correct - L* = 39
38 Partially correct 60 ms 3056 KB Output is partially correct - L* = 39
39 Partially correct 61 ms 3056 KB Output is partially correct - L* = 38
40 Partially correct 59 ms 3056 KB Output is partially correct - L* = 38