Submission #924403

# Submission time Handle Problem Language Result Execution time Memory
924403 2024-02-09T02:56:54 Z socpite Stray Cat (JOI20_stray) C++14
76 / 100
37 ms 14716 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;
				pos[v.first] = ans[v.second] ? 1 : 2;
				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;

//1001

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:9:8: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    9 |    int variable_example = 0;
      |        ^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 2392 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 2392 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 2396 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 2396 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1568 KB Output is correct
2 Correct 0 ms 1312 KB Output is correct
3 Correct 2 ms 1572 KB Output is correct
4 Correct 2 ms 1564 KB Output is correct
5 Correct 2 ms 1572 KB Output is correct
6 Correct 2 ms 1564 KB Output is correct
7 Correct 2 ms 1572 KB Output is correct
8 Correct 2 ms 1572 KB Output is correct
9 Correct 2 ms 1556 KB Output is correct
10 Correct 2 ms 1568 KB Output is correct
11 Correct 2 ms 1572 KB Output is correct
12 Correct 2 ms 1548 KB Output is correct
13 Correct 2 ms 1684 KB Output is correct
14 Correct 2 ms 1572 KB Output is correct
15 Correct 1 ms 1568 KB Output is correct
16 Correct 2 ms 1572 KB Output is correct
17 Correct 2 ms 1564 KB Output is correct
18 Correct 2 ms 1564 KB Output is correct
19 Correct 2 ms 1564 KB Output is correct
20 Correct 1 ms 1564 KB Output is correct
21 Correct 1 ms 1560 KB Output is correct
22 Correct 1 ms 1572 KB Output is correct
23 Correct 2 ms 1572 KB Output is correct
24 Correct 2 ms 1568 KB Output is correct
25 Correct 2 ms 1572 KB Output is correct
26 Correct 1 ms 1824 KB Output is correct
27 Correct 2 ms 1556 KB Output is correct
28 Correct 1 ms 1564 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 24 ms 11860 KB Output is correct
2 Correct 27 ms 12892 KB Output is correct
3 Correct 1 ms 1312 KB Output is correct
4 Correct 20 ms 11568 KB Output is correct
5 Correct 32 ms 14260 KB Output is correct
6 Correct 32 ms 14080 KB Output is correct
7 Correct 26 ms 13136 KB Output is correct
8 Correct 26 ms 13336 KB Output is correct
9 Correct 31 ms 14396 KB Output is correct
10 Correct 32 ms 14708 KB Output is correct
11 Correct 30 ms 14160 KB Output is correct
12 Correct 36 ms 13944 KB Output is correct
13 Correct 31 ms 14268 KB Output is correct
14 Correct 28 ms 14152 KB Output is correct
15 Correct 30 ms 14168 KB Output is correct
16 Correct 37 ms 14716 KB Output is correct
17 Correct 31 ms 13896 KB Output is correct
18 Correct 32 ms 13908 KB Output is correct
19 Correct 28 ms 13816 KB Output is correct
20 Correct 28 ms 14060 KB Output is correct
21 Correct 33 ms 14592 KB Output is correct
22 Correct 28 ms 13916 KB Output is correct
23 Correct 25 ms 11932 KB Output is correct
24 Correct 24 ms 11864 KB Output is correct
25 Correct 25 ms 12372 KB Output is correct
26 Correct 26 ms 12360 KB Output is correct
27 Correct 27 ms 13112 KB Output is correct
28 Correct 26 ms 13136 KB Output is correct
29 Correct 27 ms 13140 KB Output is correct
30 Correct 26 ms 13140 KB Output is correct
31 Correct 25 ms 11860 KB Output is correct
32 Correct 24 ms 11800 KB Output is correct
33 Correct 25 ms 12620 KB Output is correct
34 Correct 25 ms 12112 KB Output is correct
35 Correct 26 ms 12880 KB Output is correct
36 Correct 26 ms 12880 KB Output is correct
37 Correct 26 ms 12884 KB Output is correct
38 Correct 27 ms 12828 KB Output is correct
39 Correct 27 ms 12876 KB Output is correct
40 Correct 26 ms 12884 KB Output is correct
41 Correct 30 ms 13476 KB Output is correct
42 Correct 28 ms 13352 KB Output is correct
43 Correct 27 ms 13400 KB Output is correct
44 Correct 27 ms 13540 KB Output is correct
45 Correct 28 ms 13652 KB Output is correct
46 Correct 28 ms 13572 KB Output is correct
47 Correct 26 ms 12796 KB Output is correct
48 Correct 26 ms 12880 KB Output is correct
49 Correct 26 ms 12884 KB Output is correct
50 Correct 29 ms 12872 KB Output is correct
51 Correct 24 ms 12124 KB Output is correct
52 Correct 25 ms 12108 KB Output is correct
53 Correct 25 ms 12104 KB Output is correct
54 Correct 26 ms 12436 KB Output is correct
55 Correct 25 ms 12112 KB Output is correct
56 Correct 25 ms 12108 KB Output is correct
57 Correct 28 ms 12348 KB Output is correct
58 Correct 25 ms 12360 KB Output is correct
59 Correct 25 ms 12104 KB Output is correct
60 Correct 25 ms 12180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 11844 KB Output is correct
2 Correct 28 ms 12932 KB Output is correct
3 Correct 1 ms 1300 KB Output is correct
4 Correct 20 ms 11584 KB Output is correct
5 Correct 31 ms 14156 KB Output is correct
6 Correct 37 ms 14160 KB Output is correct
7 Correct 27 ms 13048 KB Output is correct
8 Correct 26 ms 13140 KB Output is correct
9 Correct 30 ms 14136 KB Output is correct
10 Correct 31 ms 14168 KB Output is correct
11 Correct 31 ms 14184 KB Output is correct
12 Correct 30 ms 14164 KB Output is correct
13 Correct 31 ms 14244 KB Output is correct
14 Correct 31 ms 14160 KB Output is correct
15 Incorrect 28 ms 14160 KB Wrong Answer [6]
16 Halted 0 ms 0 KB -