Submission #924408

# Submission time Handle Problem Language Result Execution time Memory
924408 2024-02-09T03:04:21 Z socpite Stray Cat (JOI20_stray) C++14
85 / 100
41 ms 14400 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, 5>> check = {
		{1, 0, 1, 0, 0},
		{0, 1, 0, 0, 1},
		{1, 0, 0, 1, 1},
		{0, 0, 1, 1, 0},
		{0, 1, 1, 0, 1},
		{1, 1, 0, 1, 0}
	};
	array<int, 5> 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;
				y[prv]--;
				crr[ptr++] = y[0] < y[1];
				crr[ptr++] = prv;
				return prv;
			}
		}
		else{
			if(!on_line){
				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 == 5){
						on_line = 0;
						if(check.find(crr) == check.end())return prv;
						else {
							prv = crr[3];
							return -1;
						}
					}
					else 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 2136 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 2136 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 2140 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 2140 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2320 KB Output is correct
2 Correct 1 ms 1300 KB Output is correct
3 Correct 2 ms 1564 KB Output is correct
4 Correct 2 ms 1568 KB Output is correct
5 Correct 2 ms 1556 KB Output is correct
6 Correct 2 ms 1556 KB Output is correct
7 Correct 2 ms 1564 KB Output is correct
8 Correct 2 ms 1568 KB Output is correct
9 Correct 2 ms 1568 KB Output is correct
10 Correct 2 ms 1568 KB Output is correct
11 Correct 2 ms 1560 KB Output is correct
12 Correct 2 ms 1568 KB Output is correct
13 Correct 2 ms 1552 KB Output is correct
14 Correct 2 ms 1560 KB Output is correct
15 Correct 1 ms 1564 KB Output is correct
16 Correct 2 ms 1560 KB Output is correct
17 Correct 2 ms 1568 KB Output is correct
18 Correct 2 ms 2068 KB Output is correct
19 Correct 2 ms 1568 KB Output is correct
20 Correct 2 ms 1568 KB Output is correct
21 Correct 2 ms 1568 KB Output is correct
22 Correct 1 ms 1560 KB Output is correct
23 Correct 2 ms 1564 KB Output is correct
24 Correct 1 ms 1564 KB Output is correct
25 Correct 2 ms 1568 KB Output is correct
26 Correct 2 ms 1568 KB Output is correct
27 Correct 1 ms 1564 KB Output is correct
28 Correct 1 ms 1564 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 11332 KB Output is correct
2 Correct 27 ms 12432 KB Output is correct
3 Correct 1 ms 1308 KB Output is correct
4 Correct 24 ms 11132 KB Output is correct
5 Correct 33 ms 13944 KB Output is correct
6 Correct 30 ms 13936 KB Output is correct
7 Correct 24 ms 12920 KB Output is correct
8 Correct 27 ms 12956 KB Output is correct
9 Correct 31 ms 14024 KB Output is correct
10 Correct 32 ms 14000 KB Output is correct
11 Correct 41 ms 13808 KB Output is correct
12 Correct 32 ms 13928 KB Output is correct
13 Correct 33 ms 13936 KB Output is correct
14 Correct 30 ms 13952 KB Output is correct
15 Correct 31 ms 13940 KB Output is correct
16 Correct 34 ms 13632 KB Output is correct
17 Correct 32 ms 13728 KB Output is correct
18 Correct 28 ms 13680 KB Output is correct
19 Correct 30 ms 13620 KB Output is correct
20 Correct 32 ms 13620 KB Output is correct
21 Correct 30 ms 13684 KB Output is correct
22 Correct 31 ms 13480 KB Output is correct
23 Correct 26 ms 11336 KB Output is correct
24 Correct 24 ms 11460 KB Output is correct
25 Correct 26 ms 12164 KB Output is correct
26 Correct 30 ms 11736 KB Output is correct
27 Correct 34 ms 12608 KB Output is correct
28 Correct 26 ms 12672 KB Output is correct
29 Correct 27 ms 12736 KB Output is correct
30 Correct 27 ms 12904 KB Output is correct
31 Correct 28 ms 11364 KB Output is correct
32 Correct 24 ms 11556 KB Output is correct
33 Correct 26 ms 12064 KB Output is correct
34 Correct 25 ms 11848 KB Output is correct
35 Correct 26 ms 12368 KB Output is correct
36 Correct 33 ms 12320 KB Output is correct
37 Correct 27 ms 12412 KB Output is correct
38 Correct 26 ms 12664 KB Output is correct
39 Correct 27 ms 12404 KB Output is correct
40 Correct 30 ms 12404 KB Output is correct
41 Correct 30 ms 12880 KB Output is correct
42 Correct 34 ms 13096 KB Output is correct
43 Correct 27 ms 12932 KB Output is correct
44 Correct 28 ms 13092 KB Output is correct
45 Correct 30 ms 13160 KB Output is correct
46 Correct 36 ms 12964 KB Output is correct
47 Correct 26 ms 12332 KB Output is correct
48 Correct 32 ms 12928 KB Output is correct
49 Correct 26 ms 12236 KB Output is correct
50 Correct 26 ms 12424 KB Output is correct
51 Correct 26 ms 11640 KB Output is correct
52 Correct 24 ms 11636 KB Output is correct
53 Correct 25 ms 11652 KB Output is correct
54 Correct 26 ms 11600 KB Output is correct
55 Correct 30 ms 12152 KB Output is correct
56 Correct 25 ms 11628 KB Output is correct
57 Correct 25 ms 11872 KB Output is correct
58 Correct 25 ms 11896 KB Output is correct
59 Correct 26 ms 11724 KB Output is correct
60 Correct 25 ms 11644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 24 ms 11536 KB Output is correct
2 Correct 26 ms 12412 KB Output is correct
3 Correct 1 ms 1300 KB Output is correct
4 Correct 20 ms 11124 KB Output is correct
5 Correct 32 ms 13996 KB Output is correct
6 Correct 30 ms 13892 KB Output is correct
7 Correct 28 ms 13040 KB Output is correct
8 Correct 28 ms 12936 KB Output is correct
9 Correct 31 ms 13960 KB Output is correct
10 Correct 33 ms 13796 KB Output is correct
11 Correct 30 ms 13940 KB Output is correct
12 Correct 32 ms 13940 KB Output is correct
13 Correct 30 ms 13940 KB Output is correct
14 Correct 31 ms 13692 KB Output is correct
15 Correct 31 ms 13900 KB Output is correct
16 Correct 30 ms 14132 KB Output is correct
17 Correct 36 ms 13812 KB Output is correct
18 Correct 33 ms 13892 KB Output is correct
19 Correct 31 ms 14400 KB Output is correct
20 Correct 28 ms 13780 KB Output is correct
21 Correct 28 ms 13908 KB Output is correct
22 Correct 27 ms 13904 KB Output is correct
23 Correct 24 ms 11816 KB Output is correct
24 Correct 24 ms 11860 KB Output is correct
25 Correct 25 ms 12368 KB Output is correct
26 Correct 28 ms 12288 KB Output is correct
27 Correct 28 ms 13072 KB Output is correct
28 Correct 27 ms 13248 KB Output is correct
29 Correct 32 ms 13128 KB Output is correct
30 Correct 27 ms 13076 KB Output is correct
31 Correct 24 ms 11860 KB Output is correct
32 Correct 25 ms 11816 KB Output is correct
33 Correct 26 ms 12356 KB Output is correct
34 Correct 26 ms 12420 KB Output is correct
35 Correct 26 ms 12880 KB Output is correct
36 Correct 28 ms 12864 KB Output is correct
37 Correct 26 ms 12880 KB Output is correct
38 Correct 26 ms 12828 KB Output is correct
39 Correct 27 ms 13012 KB Output is correct
40 Correct 30 ms 13392 KB Output is correct
41 Correct 28 ms 13656 KB Output is correct
42 Correct 28 ms 13388 KB Output is correct
43 Correct 28 ms 13396 KB Output is correct
44 Correct 30 ms 13652 KB Output is correct
45 Correct 28 ms 13448 KB Output is correct
46 Correct 31 ms 13640 KB Output is correct
47 Correct 30 ms 12796 KB Output is correct
48 Correct 27 ms 12892 KB Output is correct
49 Correct 26 ms 12876 KB Output is correct
50 Correct 26 ms 12860 KB Output is correct
51 Correct 25 ms 12184 KB Output is correct
52 Correct 25 ms 12024 KB Output is correct
53 Correct 25 ms 12344 KB Output is correct
54 Correct 25 ms 12116 KB Output is correct
55 Correct 27 ms 12116 KB Output is correct
56 Correct 25 ms 11976 KB Output is correct
57 Correct 25 ms 12360 KB Output is correct
58 Correct 25 ms 12372 KB Output is correct
59 Correct 25 ms 12108 KB Output is correct
60 Correct 25 ms 12112 KB Output is correct