답안 #924228

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
924228 2024-02-08T16:39:46 Z socpite 길고양이 (JOI20_stray) C++14
76 / 100
43 ms 14348 KB
#include "Anthony.h"
#include<bits/stdc++.h>
using namespace std;


namespace {
	const int maxn = 2e4+5;
	vector<pair<int, int>> g[maxn];
	array<int, 6> pattern = {1, 0, 1, 0, 0, 1};

	int pos[maxn];
	vector<int> ans;

	void dfs(int x, int p){
		// cout << x << endl;
		int cc = 0;
		for(auto v: g[x]){
			if(v.second == p)continue;
			cc++;
		}
		if(cc == 1){
			// only child
			for(auto v: g[x]){
				if(v.second == p)continue;
				ans[v.second] = pattern[pos[x]];
				pos[v.first] = (pos[x]+1)%6;
				dfs(v.first, v.second);
			}
		} 
		else {
			for(auto v: g[x]){
				if(v.second == p)continue;
				ans[v.second] = p == -1 ? 0 : ans[p]^1;
				dfs(v.first, v.second);
			}
		}
	}

}  // namespace




std::vector<int> Mark(int N, int M, int A, int B, vector<int> U, vector<int> V) {
  	assert(A == 2);
	ans.resize(M);
	for(int i = 0; i < M; i++){
		g[U[i]].push_back({V[i], i});
		g[V[i]].push_back({U[i], i});
	}
	for(int i = 0; i < N; i++){
		pos[i] = 0;
	}
	dfs(0, -1);
	// for(auto v: ans)cout << v << " ";
	// cout << endl;
	return ans;
}
#include "Catherine.h"
#include<bits/stdc++.h>
using namespace std;

namespace {
  	int A, B;
  	int variable_example = 0;
	int start = 1;
	int on_line = 0;
	int prv = 0;
	int ptr = 0;
	set<array<int, 6>> check = {
		{1, 0, 1, 0, 0, 1},
		{0, 1, 0, 0, 1, 1},
		{1, 0, 0, 1, 1, 0},
		{0, 0, 1, 1, 0, 1},
		{0, 1, 1, 0, 1, 0},
		{1, 1, 0, 1, 0, 0}
	};
	array<int, 6> crr;
}  // namespace

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

// MAX: <; MIN: >

int Move(std::vector<int> y) {
  	if(A == 2){
		if(start){
			start = 0;
			if(y[0] + y[1] != 2){
				if(min(y[0], y[1]) == 0)prv = y[0] < y[1];
				else prv = y[0] > y[1];
				return prv;
			}
			else {
				on_line = 1;
				prv = y[0] < y[1];
				// cout << prv << endl;
				crr[ptr++] = prv;
				return prv;
			}
		}
		else{
			if(!on_line){
				if(ptr){
					ptr = 0;
					return -1;
				}
				else {
					if(min(y[0], y[1]) == 0)prv = y[0] < y[1];
					else prv^=1;
					return prv;
				}
			}
			else {
				if(y[0] + y[1] != 1){
					on_line = 0;
					ptr = 0;
					if(min(y[0], y[1]) == 0)return -1;
					else {
						prv^=1;
						return prv;
					}
				}
				else{
					prv = y[0] < y[1];
					crr[ptr++] = prv;
					if(ptr == 6){
						on_line = 0;
						if(check.find(crr) == check.end())ptr = 0;
					}
					// cout << prv << endl;
					return prv;
				}
			}
		}
  	}
	return 0;
}

Compilation message

Catherine.cpp:7:8: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    7 |    int variable_example = 0;
      |        ^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 2136 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 2136 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 2140 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 2140 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1568 KB Output is correct
2 Correct 0 ms 1308 KB Output is correct
3 Correct 2 ms 1548 KB Output is correct
4 Correct 2 ms 1552 KB Output is correct
5 Correct 2 ms 1560 KB Output is correct
6 Correct 2 ms 1568 KB Output is correct
7 Correct 2 ms 1624 KB Output is correct
8 Correct 2 ms 1572 KB Output is correct
9 Correct 2 ms 1568 KB Output is correct
10 Correct 2 ms 1556 KB Output is correct
11 Correct 1 ms 1560 KB Output is correct
12 Correct 2 ms 1560 KB Output is correct
13 Correct 1 ms 1568 KB Output is correct
14 Correct 2 ms 1572 KB Output is correct
15 Correct 1 ms 1564 KB Output is correct
16 Correct 1 ms 1564 KB Output is correct
17 Correct 1 ms 1572 KB Output is correct
18 Correct 1 ms 1572 KB Output is correct
19 Correct 2 ms 1572 KB Output is correct
20 Correct 1 ms 1572 KB Output is correct
21 Correct 2 ms 1572 KB Output is correct
22 Correct 1 ms 1572 KB Output is correct
23 Correct 1 ms 1568 KB Output is correct
24 Correct 2 ms 1572 KB Output is correct
25 Correct 1 ms 1556 KB Output is correct
26 Correct 2 ms 1572 KB Output is correct
27 Correct 2 ms 1568 KB Output is correct
28 Correct 1 ms 1572 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 11388 KB Output is correct
2 Correct 28 ms 12688 KB Output is correct
3 Correct 1 ms 1308 KB Output is correct
4 Correct 20 ms 11132 KB Output is correct
5 Correct 31 ms 13996 KB Output is correct
6 Correct 28 ms 13944 KB Output is correct
7 Correct 25 ms 13004 KB Output is correct
8 Correct 25 ms 12916 KB Output is correct
9 Correct 30 ms 14168 KB Output is correct
10 Correct 28 ms 14240 KB Output is correct
11 Correct 30 ms 14152 KB Output is correct
12 Correct 28 ms 14092 KB Output is correct
13 Correct 31 ms 14076 KB Output is correct
14 Correct 32 ms 14164 KB Output is correct
15 Correct 30 ms 14156 KB Output is correct
16 Correct 30 ms 14128 KB Output is correct
17 Correct 26 ms 13904 KB Output is correct
18 Correct 27 ms 14072 KB Output is correct
19 Correct 27 ms 13912 KB Output is correct
20 Correct 27 ms 13916 KB Output is correct
21 Correct 28 ms 14044 KB Output is correct
22 Correct 26 ms 13920 KB Output is correct
23 Correct 28 ms 12324 KB Output is correct
24 Correct 24 ms 11860 KB Output is correct
25 Correct 24 ms 12360 KB Output is correct
26 Correct 25 ms 12356 KB Output is correct
27 Correct 27 ms 12880 KB Output is correct
28 Correct 26 ms 12884 KB Output is correct
29 Correct 26 ms 12924 KB Output is correct
30 Correct 32 ms 12888 KB Output is correct
31 Correct 24 ms 11864 KB Output is correct
32 Correct 24 ms 11852 KB Output is correct
33 Correct 25 ms 12108 KB Output is correct
34 Correct 25 ms 12100 KB Output is correct
35 Correct 27 ms 12800 KB Output is correct
36 Correct 26 ms 12876 KB Output is correct
37 Correct 26 ms 12868 KB Output is correct
38 Correct 26 ms 12880 KB Output is correct
39 Correct 32 ms 12884 KB Output is correct
40 Correct 26 ms 12884 KB Output is correct
41 Correct 26 ms 13356 KB Output is correct
42 Correct 27 ms 13620 KB Output is correct
43 Correct 27 ms 13360 KB Output is correct
44 Correct 28 ms 13400 KB Output is correct
45 Correct 28 ms 13392 KB Output is correct
46 Correct 27 ms 13332 KB Output is correct
47 Correct 26 ms 12852 KB Output is correct
48 Correct 26 ms 12928 KB Output is correct
49 Correct 25 ms 12620 KB Output is correct
50 Correct 26 ms 12704 KB Output is correct
51 Correct 24 ms 12120 KB Output is correct
52 Correct 26 ms 12300 KB Output is correct
53 Correct 24 ms 12376 KB Output is correct
54 Correct 31 ms 12376 KB Output is correct
55 Correct 24 ms 12104 KB Output is correct
56 Correct 24 ms 12368 KB Output is correct
57 Correct 24 ms 12384 KB Output is correct
58 Correct 26 ms 12080 KB Output is correct
59 Correct 25 ms 12108 KB Output is correct
60 Correct 24 ms 12096 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 11388 KB Output is correct
2 Correct 25 ms 12164 KB Output is correct
3 Correct 1 ms 1296 KB Output is correct
4 Correct 20 ms 11148 KB Output is correct
5 Correct 30 ms 13940 KB Output is correct
6 Correct 30 ms 13816 KB Output is correct
7 Correct 26 ms 12932 KB Output is correct
8 Correct 27 ms 13136 KB Output is correct
9 Correct 28 ms 14268 KB Output is correct
10 Correct 28 ms 14176 KB Output is correct
11 Correct 28 ms 14348 KB Output is correct
12 Correct 28 ms 14104 KB Output is correct
13 Correct 28 ms 14164 KB Output is correct
14 Correct 28 ms 14096 KB Output is correct
15 Incorrect 43 ms 14288 KB Wrong Answer [6]
16 Halted 0 ms 0 KB -