Submission #1179213

#TimeUsernameProblemLanguageResultExecution timeMemory
1179213ppmn_6Stray Cat (JOI20_stray)C++20
15 / 100
40 ms13896 KiB
#include "Anthony.h"
#include <bits/stdc++.h>
using namespace std;

std::vector<int> Mark(int N, int M, int A, int B, std::vector<int> U, std::vector<int> V) {
	vector<vector<int>> graph(N);
	vector<int> res(M), depth(N);
	for (int i = 0; i < M; i++) {
		graph[U[i]].push_back(V[i]);
		graph[V[i]].push_back(U[i]);
	}
	vector<bool> vis(N, 0);
	queue<pair<int, int>> q;
	vis[0] = 1;
	q.push({0, 0});
	while (q.size()) {
		auto [c, d] = q.front();
		q.pop();
		depth[c] = d;
		for (auto i : graph[c]) {
			if (!vis[i]) {
				q.push({i, d + 1});
				vis[i] = 1;
			}
		}
	}
	if (A >= 3) {
		for (int i = 0; i < M; i++) {
			int du = depth[U[i]];
			int dv = depth[V[i]];
			int m = max(du, dv);
			if (du == dv) {
				res[i] = (du + 1) % 3;
				continue;
			}
			res[i] = m % 3;
		}
	}
	else {
		for (int i = 0; i < M; i++) {
			int du = depth[U[i]];
			int dv = depth[V[i]];
			int m = min(du, dv);
			res[i] = m % 2;
		}
	}
	
	return res;
}

/*int main() {
	int n, m;
	cin >> n >> m;
	vector<int> u(m), v(m);
	for (int i = 0; i < m; i++) {
		cin >> u[i] >> v[i];
		u[i]--; v[i]--;
	}
	for (auto i : Mark(n, m, 3, 0, u, v)) {
		cout << i << " ";
	}
	
	return 0;
}*/
#include "Catherine.h"
#include <bits/stdc++.h>

namespace {
	int a, b;
}

void Init(int A, int B) {
	::a = A;
	::b = B;
}

int Move(std::vector<int> y) {
	if (::a >= 3) {
		if (!y[0] && !y[2]) {
			return 1;
		}
		if (!y[0] && !y[1]) {
			return 2;
		}
		if (!y[1] && !y[2]) {
			return 0;
		}
		if (y[0] && y[1]) {
			return 0;
		}
		if (y[0] && y[2]) {
			return 2;
		}
		if (y[1] && y[2]) {
			return 1;
		}
	}
	else {
		if (y[0] == 1) {
			return 0;
		}
		return 1;
	}
}

Compilation message (stderr)

# 2번째 컴파일 단계

Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:40:1: warning: control reaches end of non-void function [-Wreturn-type]
   40 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...