답안 #115899

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
115899 2019-06-09T13:09:40 Z aminra Broken Device (JOI17_broken_device) C++14
컴파일 오류
0 ms 0 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, ll X, int K, int P[])
{
    vector <int> bad(N, 0), ans(N, 0);
    for(int i = 0; i < K; i++)
        bad[P[i]] = 1;
    for(int i = 0; i < N; i += 3)
	{
        if(bad[i] + bad[i + 1] + bad[i + 2] > 1)
            continue;
        if(bad[i] + bad[i + 1] + bad[i + 2] == 0)
		{
            if((X & 3) == 0)
                ans[i] = 1;
            else
			if((X & 3) == 2)
                ans[i] = ans[i + 2] = 1;
            else
			if((X & 3) == 1)
                ans[i + 1] = ans[i + 2] = 1;
            else
			if((X & 3) == 3)
                ans[i] = ans[i + 1] = ans[i + 2] = 1;
            X >>= 2;
        }
        else
        {
            if(bad[i + 1] == 0)
			{
                if(X & 1)
				{
                    if(bad[i + 2] == 0)
                        ans[i + 2] = 1;
                    else
                        ans[i] = ans[i + 1] = 1;
                }
                else
                    ans[i + 1] = 1;
                X >>= 1;
            }
            else
			{
                if(X & 1)
                    ans[i + 2] = 1, X >>= 1;
                else
                if((X & 3) == 0) 
                    ans[i] = 1;
                else
				if((X & 3) == 2)
                    ans[i] = ans[i + 2] = 1, X >>= 2;
            }
        }
    }
    for(i = 0; i < N; i++)
        Set(i, ans[i]);
}
/*int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
}*/
#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;
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);
}*/

Compilation message

Anna.cpp: In function 'void Anna(int, ll, int, int*)':
Anna.cpp:62:9: error: 'i' was not declared in this scope
     for(i = 0; i < N; i++)
         ^