답안 #115901

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
115901 2019-06-09T13:38:54 Z aminra Broken Device (JOI17_broken_device) C++14
100 / 100
67 ms 3128 KB
#include <bits/stdc++.h>
#include "Annalib.h"
using namespace std;
typedef long long ll;
typedef long double ld;
const int MOD = (int)1e9 + 7;
const int MAXN = (int)153;
const int infint = (int)1e9 + 3;
const ll inf = (ll)1e18;
void Anna(int N, long long X, int K, int P[] ){
 
    vector <int> arr(N);
    for(int i = 0; i < K; i++)
        arr[P[i]] = 1;
    vector <int> sol(N, 0);
 
    for(int i = 0; i < N; i += 3)
    {
        int a = arr[i], b = arr[i + 1], c = arr[i + 2];
        if(a + b + c > 1)
            continue;
        if(a + b + c == 0)
		{
            if((X & 3) == 0)
                sol[i] = 1;
            else
			if((X & 3) == 2)
                sol[i] = sol[i + 2] = 1;
            else
			if((X & 3) == 1)
                sol[i + 1] = sol[i + 2] = 1;
            else
			if((X & 3) == 3)
                sol[i] = sol[i + 1] = sol[i + 2] = 1;
            X /= 4;
        }
        else 
		{
            if(b == 0)
			{
                if(X & 1)
				{
                    if(c == 0)
                        sol[i + 2] = 1;
                    else
                        sol[i] = sol[i + 1] = 1;
                }
                else
                    sol[i + 1] = 1;
                X /= 2;
            }
            else
			{
                if(X & 1) 
                    sol[i + 2] = 1, X /= 2;
                else
				{
                    if((X & 3) == 0)
                        sol[i] = 1;
                    else
					if((X & 3) == 2)
                        sol[i] = sol[i + 2] = 1;
                    X >>= 2;
                }
            }
        }
    }
    for(int i = 0; i < N; i++)
        Set(i, sol[i]);
}
/*int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
}*/
#include <bits/stdc++.h>
#include "Brunolib.h"
using namespace std;
typedef long long ll;
typedef long double ld;
const int MOD = (int)1e9 + 7;
const int MAXN = (int)153;
const int infint = (int)1e9 + 3;
const ll inf = (ll)1e18;
ll Bruno(int N, int A[])
{
	ll ans = 0;
	for (int i = N - 3; i >= 0; i -= 3)
		if(A[i] == 0 && A[i + 1] == 0 && A[i + 2] == 0)
			continue;
		else
		if(A[i] == 1 && A[i + 1] == 0 && A[i + 2] == 0)
			ans = 1LL * ans * 4;
		else
		if(A[i] == 0 && A[i + 1] == 1 && A[i + 2] == 1)
			ans = 1LL * ans * 4 + 1;
		else
		if(A[i] == 1 && A[i + 1] == 0 && A[i + 2] == 1)
			ans = 1LL * ans * 4 + 2;
		else
		if(A[i] == 1 && A[i + 1] == 1 && A[i + 2] == 1)
			ans = 1LL * ans * 4 + 3;
		else
		if(A[i] == 0 && A[i + 1] == 0 && A[i + 2] == 1)
			ans = 1LL * ans * 2 + 1;
		else
		if(A[i] == 0 && A[i + 1] == 1 && A[i + 2] == 0)
			ans = 1LL * ans * 2;
		else
			ans = 1LL * ans * 2 + 1;
	return ans;
}
/*int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
}*/
# 결과 실행 시간 메모리 Grader output
1 Correct 36 ms 3016 KB Output is correct - L* = 40
2 Correct 36 ms 3072 KB Output is correct - L* = 40
3 Correct 35 ms 3056 KB Output is correct - L* = 40
4 Correct 34 ms 3072 KB Output is correct - L* = 40
5 Correct 36 ms 3072 KB Output is correct - L* = 40
6 Correct 35 ms 3072 KB Output is correct - L* = 40
7 Correct 39 ms 3056 KB Output is correct - L* = 40
8 Correct 35 ms 3072 KB Output is correct - L* = 40
9 Correct 34 ms 3072 KB Output is correct - L* = 40
10 Correct 33 ms 3056 KB Output is correct - L* = 40
11 Correct 34 ms 3072 KB Output is correct - L* = 40
12 Correct 34 ms 3072 KB Output is correct - L* = 40
13 Correct 34 ms 3056 KB Output is correct - L* = 40
14 Correct 35 ms 3016 KB Output is correct - L* = 40
15 Correct 35 ms 3072 KB Output is correct - L* = 40
16 Correct 34 ms 3056 KB Output is correct - L* = 40
17 Correct 35 ms 3072 KB Output is correct - L* = 40
18 Correct 35 ms 3072 KB Output is correct - L* = 40
19 Correct 41 ms 2912 KB Output is correct - L* = 40
20 Correct 34 ms 3072 KB Output is correct - L* = 40
21 Correct 36 ms 3072 KB Output is correct - L* = 40
22 Correct 35 ms 3072 KB Output is correct - L* = 40
23 Correct 67 ms 3056 KB Output is correct - L* = 40
24 Correct 35 ms 3128 KB Output is correct - L* = 40
25 Correct 35 ms 3072 KB Output is correct - L* = 40
26 Correct 36 ms 3056 KB Output is correct - L* = 40
27 Correct 35 ms 3072 KB Output is correct - L* = 40
28 Correct 34 ms 3072 KB Output is correct - L* = 40
29 Correct 35 ms 3056 KB Output is correct - L* = 40
30 Correct 35 ms 3072 KB Output is correct - L* = 40
31 Correct 35 ms 3072 KB Output is correct - L* = 40
32 Correct 33 ms 3072 KB Output is correct - L* = 40
33 Correct 33 ms 3072 KB Output is correct - L* = 40
34 Correct 34 ms 3072 KB Output is correct - L* = 40
35 Correct 35 ms 3072 KB Output is correct - L* = 40
36 Correct 30 ms 2816 KB Output is correct - L* = 40
37 Correct 35 ms 3072 KB Output is correct - L* = 40
38 Correct 33 ms 3072 KB Output is correct - L* = 40
39 Correct 35 ms 3072 KB Output is correct - L* = 40
40 Correct 35 ms 3072 KB Output is correct - L* = 40