Submission #246328

# Submission time Handle Problem Language Result Execution time Memory
246328 2020-07-08T16:44:06 Z kostia244 Stray Cat (JOI20_stray) C++17
Compilation error
0 ms 0 KB
#include "Catherine.h"
#include <bits/stdc++.h>
#define pb push_back
using namespace std;

namespace kate {

int A, B, gg = 0, lst = -2;
string cur, god = "110100110100";
int decide(vector<int> c) {
	if(c[0] + c[1] + (lst != -2) > 2) {
		gg = 1;
		if(c[0]+(lst==0) == 1) {
			return lst = 0;
		}
		return lst = 1;
	}
	if(c[0] + c[1] == 2) {
		if(c[0]) {
			cur.pb('0'+c[1]);
			cur.pb('0');
			return lst = 0;
		}
		cur += "11";
		return lst = 1;
	}
	if(gg) return lst = c[1];
	cur.pb('0'+c[1]);
	if(cur.size() == 5) {
		gg = 1;
		if(god.find(cur) == string::npos) return lst = -1;
		return lst = c[1];
	}
}


}  // namespace

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

int Move(std::vector<int> y) {
	return kate::decide(y);
}

#include "Anthony.h"
#include <bits/stdc++.h>
#define pb push_back
using namespace std;


namespace anton {
const int maxn = 1<<17;
vector<int> val, p, pidx, col,  god = {1, 1, 0, 1, 0, 0};
vector<array<int, 2>> g[maxn];
void dfs(int v) {
	for(auto &[i, idx] : g[v]) if(i != p[v]) {
		p[i] = v, pidx[i] = idx;
		col[i] = col[v]^1;
		dfs(i);
	}
	if(!v) return;
	int u = p[v];
	vector<int> l {v};
	while(u && g[u].size() > 1) {
		l.pb(u);
		u = p[u];
	}
	int b = 0;
	while(god[b] != col[v] || god[(b + l.size() - 1)%6] != col[l.back()]) b++;
	for(int i = 0; i < l.size(); i++) val[pidx[l[i]]] = god[(i+b)%6];
}

} 

std::vector<int> Mark(int N, int M, int A, int B,
                      std::vector<int> U, std::vector<int> V) {
  using namespace anton;
  val.resize(M);
  for(int i = 0; i < M; i++) {
	  g[U[i]].pb({V[i], i});
	  g[V[i]].pb({U[i], i});
  }
  p.resize(N);
  pidx.resize(N);
  col.resize(N);
  dfs(0);
  return val;
}



    

Compilation message

Anthony.cpp: In function 'void anton::dfs(int)':
Anthony.cpp:73:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < l.size(); i++) val[pidx[l[i]]] = god[(i+b)%6];
                 ~~^~~~~~~~~~
Anthony.cpp: In function 'int kate::decide(std::vector<int>)':
Anthony.cpp:34:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^

/tmp/ccYoNqNn.o: In function `main':
grader_catherine.cpp:(.text.startup+0x2ec): undefined reference to `Init(int, int)'
grader_catherine.cpp:(.text.startup+0xef4): undefined reference to `Move(std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status