답안 #445217

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
445217 2021-07-16T22:32:55 Z flappybird 길고양이 (JOI20_stray) C++14
5 / 100
73 ms 21048 KB
#include "Anthony.h"
#include <vector>
using namespace std;
typedef int ll;
#define MAX 101010

namespace {
	vector<ll> adj[MAX], num[MAX], depth, deg;
	vector<ll> ret;
	ll asdf[6] = { 1, 1, 0, 1, 0, 0 };
	void dfs(ll x = 0, ll p = -1, ll d = 1, ll str = 0) {
		depth[x] = d;
		ll i;
		for (i = 0; i < (int)adj[x].size(); i++) {
			if (adj[x][i] == p) continue;
			if (deg[adj[x][i]] == 2 || deg[x] == 2) {
				while (d != asdf[str % 6]) str++;
				ret[num[x][i]] = asdf[str % 6];
				dfs(adj[x][i], x, !asdf[str % 6], str + 1);
			}
			else {
				ret[num[x][i]] = d;
				dfs(adj[x][i], x, !d);
			}
		}
	}
}  // namespace

std::vector<int> Mark(int N, int M, int A, int B, std::vector<int> U, std::vector<int> V) {
	ret.resize(M);
	deg.resize(N);
	ll i;
	for (i = 0; i < M; i++) adj[U[i]].push_back(V[i]);
	for (i = 0; i < M; i++) num[U[i]].push_back(i);
	for (i = 0; i < M; i++) adj[V[i]].push_back(U[i]);
	for (i = 0; i < M; i++) num[V[i]].push_back(i);
	for (i = 0; i < M; i++) deg[U[i]]++, deg[V[i]]++;
	depth.resize(N);
	dfs();
	return ret;
}
#include "Catherine.h"
#include <bits/stdc++.h>
using namespace std;
typedef int ll;

namespace {

int A, B;
int variable_example = 0;
ll pv;
ll str;
ll last;
string up[6], down[6];

bool chk(string s) {
	for (ll i = 0; i < 6; i++) {
		if (s == up[i]) return true;
	}
	return false;
}

string s;

}  // namespace

void Init(int A, int B) {
	::A = A;
	::B = B;
	pv = -1;
	str = 0;
	last = 0;
	up[0] = "00101";
	up[1] = "01011";
	up[2] = "10110";
	up[3] = "01100";
	up[4] = "11001";
	up[5] = "10010";
}

int Move(std::vector<int> y) {
	if (pv != -1) {
		if ((y[0] + y[1] + 1) != 2) {
			str = 0;
			s.clear();
			last = 1;
			y[pv]++;
			if (y[0] == 1) {
				if (pv == 0) return -1;
				else return pv = 0;
			}
			else {
				if (pv == 1) return -1;
				else return pv = 1;
			}
		}
		else {
			if (!last) {
				str++;
				ll nxt;
				if (y[0]) nxt = 0;
				else nxt = 1;
				s.push_back(nxt + 48);
				if (str == 5) {
					if (chk(s)) {
						last = 1;
						str = 0;
						s.clear();
						return pv = nxt;
					}
					else {
						last = 1;
						str = 0;
						s.clear();
						return -1;
					}
				}
				else {
					return pv = nxt;
				}
			}
			else {
				if (y[0]) return pv = 0;
				else return pv = 1;
			}
		}
	}
	else {
		if ((y[0] + y[1]) != 2) {
			last = 1;
			if (y[0] == 1) return pv = 0;
			else return pv = 1;
		}
		else {
			if (y[0] == 2) {
				s.push_back('0');
				s.push_back('0');
				str += 2;
				return pv = 0;
			}
			else if (y[1] == 2) {
				s.push_back('1');
				s.push_back('1');
				str += 2;
				return pv = 1;
			}
			else {
				s.push_back('0');
				s.push_back('1');
				str += 2;
				return pv = 1;
			}
		}
	}
}

Compilation message

Catherine.cpp:9:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    9 | int variable_example = 0;
      |     ^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 48 ms 21048 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 48 ms 21048 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 46 ms 18704 KB Output is correct
2 Correct 3 ms 5228 KB Output is correct
3 Correct 39 ms 17628 KB Output is correct
4 Correct 73 ms 20872 KB Output is correct
5 Incorrect 55 ms 20844 KB Wrong Answer [6]
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 46 ms 18704 KB Output is correct
2 Correct 3 ms 5228 KB Output is correct
3 Correct 39 ms 17628 KB Output is correct
4 Correct 73 ms 20872 KB Output is correct
5 Incorrect 55 ms 20844 KB Wrong Answer [6]
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 5624 KB Output is correct
2 Correct 3 ms 5232 KB Output is correct
3 Correct 4 ms 5616 KB Output is correct
4 Correct 5 ms 5616 KB Output is correct
5 Correct 4 ms 5616 KB Output is correct
6 Correct 4 ms 5616 KB Output is correct
7 Correct 4 ms 5616 KB Output is correct
8 Correct 4 ms 5620 KB Output is correct
9 Correct 4 ms 5616 KB Output is correct
10 Correct 4 ms 5616 KB Output is correct
11 Correct 4 ms 5616 KB Output is correct
12 Correct 4 ms 5616 KB Output is correct
13 Correct 4 ms 5616 KB Output is correct
14 Correct 4 ms 5616 KB Output is correct
15 Correct 4 ms 5616 KB Output is correct
16 Correct 4 ms 5592 KB Output is correct
17 Correct 4 ms 5624 KB Output is correct
18 Correct 4 ms 5624 KB Output is correct
19 Correct 4 ms 5616 KB Output is correct
20 Correct 4 ms 5616 KB Output is correct
21 Correct 4 ms 5616 KB Output is correct
22 Correct 4 ms 5616 KB Output is correct
23 Correct 4 ms 5616 KB Output is correct
24 Correct 4 ms 5616 KB Output is correct
25 Correct 4 ms 5616 KB Output is correct
26 Correct 4 ms 5616 KB Output is correct
27 Correct 4 ms 5616 KB Output is correct
28 Correct 4 ms 5616 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 46 ms 16248 KB Output is correct
2 Correct 48 ms 17432 KB Output is correct
3 Correct 3 ms 5228 KB Output is correct
4 Correct 38 ms 15940 KB Output is correct
5 Correct 55 ms 19196 KB Output is correct
6 Correct 55 ms 19228 KB Output is correct
7 Incorrect 43 ms 18492 KB Wrong Answer [6]
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 43 ms 16168 KB Output is correct
2 Correct 46 ms 17296 KB Output is correct
3 Correct 3 ms 5228 KB Output is correct
4 Correct 40 ms 16060 KB Output is correct
5 Correct 56 ms 19216 KB Output is correct
6 Correct 60 ms 19328 KB Output is correct
7 Incorrect 41 ms 18492 KB Wrong Answer [6]
8 Halted 0 ms 0 KB -