답안 #131733

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
131733 2019-07-17T13:42:37 Z MohamedAhmed04 Broken Device (JOI17_broken_device) C++14
90 / 100
96 ms 3312 KB
#include "Annalib.h"
#include <bits/stdc++.h>

using namespace std ;

void Anna( int N, long long X, int K, int P[] )
{
	srand(543739) ;
	vector<int>v ;
	for(int i = 0 ; i < N ; ++i)
		v.push_back(i) ;
	random_shuffle(v.begin() , v.end()) ;
	int mark[N+1] ;
	for(int i = 0 ; i <= N ; ++i)
		mark[i] = 0 ;
	for(int i = 0 ; i < K ; ++i)
		mark[P[i]] = 1;
	for(int i = 0 ; i < N-1 ; i += 2)
	{
		if(mark[v[i]])
			mark[v[i+1]] = 1 ;
		if(mark[v[i+1]])
			mark[v[i]] = 1 ;
	}
	int last = -1 ;
	for(int i = 0 ; i < N ; i += 2)
	{
		last = i+1 ;
		if(mark[v[i]] || X == 0)
		{
			Set(v[i] , 0) ;
			Set(v[i+1] , 0) ;
			continue ;
		}
		int now = X % 3 ;
		X /= 3 ;
		if(now == 0)
		{
			Set(v[i] , 0) ;
			Set(v[i+1] , 1) ;
		}
		else if(now == 1)
		{
			Set(v[i] , 1) ;
			Set(v[i+1] , 0) ;
		}
		else
		{
			Set(v[i] , 1) ;
			Set(v[i+1] , 1) ;
		}
	}
	if(last < N-1)
		Set(v[N-1] , 0) ;
}
#include "Brunolib.h"
#include <bits/stdc++.h>

using namespace std ;

long long Bruno( int N, int A[] )
{
   srand(543739) ;
   vector<int>v ;
  for(int i = 0 ; i < N ; ++i)
    v.push_back(i) ;
  random_shuffle(v.begin() , v.end()) ;
  vector<int>v1 ;
   long long ans = 0ll ;
   for(int i = 0 ; i < N-1 ; i += 2)
   {
      if(A[v[i]] == 0 && A[v[i+1]] == 0)
        continue ;
      if(A[v[i]] == 0 && A[v[i+1]] == 1)
        v1.push_back(0) ;
      else if(A[v[i]] == 1 && A[v[i+1]] == 0)
        v1.push_back(1) ;
      else if(A[v[i]] == 1 && A[v[i+1]] == 1)
        v1.push_back(2) ;
   }
   reverse(v1.begin() , v1.end()) ;
   for(auto &i : v1)
      ans = ans * 3ll + i * 1ll ;
   return ans;    
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 55 ms 3056 KB Output is partially correct - L* = 38
2 Partially correct 56 ms 3056 KB Output is partially correct - L* = 38
3 Partially correct 56 ms 3008 KB Output is partially correct - L* = 38
4 Partially correct 55 ms 3056 KB Output is partially correct - L* = 39
5 Partially correct 56 ms 3056 KB Output is partially correct - L* = 38
6 Partially correct 56 ms 3056 KB Output is partially correct - L* = 38
7 Partially correct 55 ms 3056 KB Output is partially correct - L* = 38
8 Partially correct 56 ms 3056 KB Output is partially correct - L* = 39
9 Partially correct 96 ms 3056 KB Output is partially correct - L* = 38
10 Partially correct 56 ms 3056 KB Output is partially correct - L* = 38
11 Partially correct 59 ms 3056 KB Output is partially correct - L* = 38
12 Partially correct 55 ms 3056 KB Output is partially correct - L* = 38
13 Partially correct 55 ms 3064 KB Output is partially correct - L* = 38
14 Partially correct 56 ms 3056 KB Output is partially correct - L* = 39
15 Partially correct 56 ms 3056 KB Output is partially correct - L* = 38
16 Partially correct 56 ms 3312 KB Output is partially correct - L* = 38
17 Partially correct 55 ms 3064 KB Output is partially correct - L* = 38
18 Partially correct 56 ms 3056 KB Output is partially correct - L* = 38
19 Partially correct 57 ms 3056 KB Output is partially correct - L* = 38
20 Partially correct 55 ms 3056 KB Output is partially correct - L* = 38
21 Partially correct 56 ms 3056 KB Output is partially correct - L* = 38
22 Partially correct 55 ms 3056 KB Output is partially correct - L* = 39
23 Partially correct 57 ms 3056 KB Output is partially correct - L* = 39
24 Partially correct 57 ms 3056 KB Output is partially correct - L* = 38
25 Partially correct 59 ms 3056 KB Output is partially correct - L* = 38
26 Partially correct 55 ms 3056 KB Output is partially correct - L* = 38
27 Partially correct 55 ms 3056 KB Output is partially correct - L* = 38
28 Partially correct 56 ms 3056 KB Output is partially correct - L* = 38
29 Partially correct 56 ms 2808 KB Output is partially correct - L* = 38
30 Partially correct 56 ms 3056 KB Output is partially correct - L* = 39
31 Partially correct 59 ms 3056 KB Output is partially correct - L* = 39
32 Partially correct 56 ms 3056 KB Output is partially correct - L* = 38
33 Partially correct 56 ms 3144 KB Output is partially correct - L* = 38
34 Partially correct 56 ms 3056 KB Output is partially correct - L* = 38
35 Partially correct 56 ms 3056 KB Output is partially correct - L* = 38
36 Partially correct 55 ms 3008 KB Output is partially correct - L* = 38
37 Partially correct 57 ms 3056 KB Output is partially correct - L* = 38
38 Partially correct 59 ms 3056 KB Output is partially correct - L* = 39
39 Partially correct 57 ms 3056 KB Output is partially correct - L* = 38
40 Partially correct 56 ms 3056 KB Output is partially correct - L* = 38