답안 #422160

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
422160 2021-06-09T19:42:07 Z errorgorn Navigation 2 (JOI21_navigation2) C++17
0 / 100
0 ms 192 KB
#include "Anna.h"

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ii pair<ll,ll>
#define fi first
#define se second

#define puf push_front
#define pof pop_front
#define pub push_back
#define pob pop_back
#define lb lower_bound
#define ub upper_bound

#define rep(x,s,e) for (auto x=s-(s>e);x!=e-(s>e);s<e?x++:x--)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()

namespace {
	int n,k;
	
	int grid[105][105];
} // namespace

void Anna(int N, int K, std::vector<int> R, std::vector<int> C) {
	n=N,k=K;
	
	rep(bit,0,k){
		rep(x,0,n) rep(y,0,n){
			if (y==C[bit]) grid[x][y]|=(1<<bit);
			if (x==R[bit] && y<=C[bit]+1) grid[x][y]|=(1<<bit);
			if (y<C[bit]){
				if (x<R[bit] && ((R[bit]-x)%3==0 || (R[bit]-x)%3==2)) grid[x][y]|=(1<<bit);
				if (x>R[bit] && (x-R[bit])%3==0) grid[x][y]|=(1<<bit);
			}
		}
	}
	
	rep(x,0,n) rep(y,0,n) SetFlag(x,y,grid[x][y]+1);
}
#include "Bruno.h"

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ii pair<ll,ll>
#define fi first
#define se second

#define puf push_front
#define pof pop_front
#define pub push_back
#define pob pop_back
#define lb lower_bound
#define ub upper_bound

#define rep(x,s,e) for (auto x=s-(s>e);x!=e-(s>e);s<e?x++:x--)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()

namespace {
	int k;
} // namespace

std::vector<int> Bruno(int K, std::vector<int> value) {
	k=K;
	for (auto &it:value) it--;
	
	vector<int> ans;
	rep(bit,0,k){
		vector<int> flip;
		rep(x,0,9){
			if (value[x]&(1<<bit)) flip.pub(1);
			else flip.pub(0);
		}
		
		if (flip[1] && flip[4] && flip[7]){
			if (flip[3] && flip[5]) ans.pub(4);
			else if (flip[0]+flip[3]+flip[6]==2) ans.pub(2);
			else ans.pub(3);
		}
		else if (!flip[2] && !flip[5] && !flip[8]) ans.pub(1);
		else ans.pub(0);
	}
	
	//for (auto &it:ans) cout<<it<<" "; cout<<endl;
	//for (auto &it:ans) cout<<it<<" "; cout<<endl;
	
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 192 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -