Submission #710623

# Submission time Handle Problem Language Result Execution time Memory
710623 2023-03-15T12:35:24 Z hpesoj Stray Cat (JOI20_stray) C++17
0 / 100
37 ms 15588 KB
#include <bits/stdc++.h>
#include "Anthony.h"
#define pb push_back
#define pi pair <int, int>
#define fi first
#define se second
using namespace std;
vector <pi> adj[20005];
vector <int> ans;
queue <int> q;
bool visited[20005];
int curr = -1;
//110100110100
int f(int x){
	if(x == 0 or x == 1 or x == 3) return 1;
	else return 0;
}
void dfs(int x, int p, int c){
	if((x == 0 and adj[x].size() >= 2) or adj[x].size() > 2){
		curr = -1;
		int col = (c ? 0 : 1);
		for(pi i : adj[x]){
			if(i.fi == p) continue;
			ans[i.se] = col;
			dfs(i.fi, x, col);
		}
	}
	else{ //line
		 if(curr == -1){
			 if(c == 0) curr = 0;
			 else curr = 1;
		 }
		 for(pi i : adj[x]){
			 if(i.fi == p) continue;
			 ans[i.se] = f(curr);
			 curr = (curr + 1) % 6;
			 dfs(i.fi, x, f(curr));
		 }
	}
}
std::vector <int> Mark(int n, int m, int a, int b, std::vector <int> u, std::vector <int> v){
	for(int i = 0; i < m; i++) ans.pb(0);
	for(int i = 0; i < m; i++) adj[u[i]].pb({v[i], i}), adj[v[i]].pb({u[i], i});
	dfs(0, -1, 0);
	return ans;
}
#include <bits/stdc++.h>
//#include "Catherine.h"
#define pb push_back
#define pi pair <int, int>
#define fi first
#define se second
using namespace std;
string seq, s[6];
bool correct;
int cnt;
//110100110100

void Init(int a, int b){
	s[0] = "11010";
	s[1] = "10100";
	s[2] = "01001";
	s[3] = "10011";
	s[4] = "00110";
	s[5] = "01101";
}
int Move(std::vector <int> y){
	//initial
	if(cnt == 0){
		if(y[0] + y[1] != 2) correct = 1;
		else{
			seq.pb('0'), seq.pb('1');
			cnt++;
			return 1;
		}
	}
	if(cnt <= 3 and !correct){
		cnt++;
		if(y[0] + y[1] == 1){
			if(y[0]){
				seq.pb('0');
				return 0;
			}
			else{
				seq.pb('1');
				return 1;
			}
		}
		else{
			if(y[0] + y[1] == 0){
				correct = 1;
				return -1;
			}
			else if(y[0] == 1){
				correct = 1;
				return 0;
			}
			else if(y[1] == 1){
				correct = 1;
				return 1;
			}
			else{
				correct = 1;
				return -1;
			}
		}
	}
	if(cnt > 3 and !correct){
		for(int k = 0; k < 6; k++) if(seq == s[k]){
			correct = 1;
			return -1;
		}
		correct = 1;
	}
	//correct direction
	if(y[0] + y[1] > 2){
		if(y[0] == 1) return 0;
		else return 1;
	}
	else if(y[0] == 1) return 0;
	else if(y[1] == 1) return 1;
}

Compilation message

Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:76:1: warning: control reaches end of non-void function [-Wreturn-type]
   76 | }
      | ^
# Verdict Execution time Memory Grader output
1 Incorrect 34 ms 15588 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 34 ms 15588 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 37 ms 13472 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 37 ms 13472 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1288 KB Output is correct
2 Incorrect 2 ms 1036 KB Wrong Answer [5]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 34 ms 11484 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 33 ms 11436 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -