Submission #218906

# Submission time Handle Problem Language Result Execution time Memory
218906 2020-04-03T05:20:18 Z dvdg6566 Stray Cat (JOI20_stray) C++14
15 / 100
74 ms 17228 KB
#include "Anthony.h"
#include <vector>

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef long double ld;
#define pb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ALL(x) x.begin(), x.end()
#define SZ(x) (ll)x.size()
#define f first
#define s second
const int MAXN = 20010;

vpi A[MAXN];
int spec[MAXN];
vi out;
int dst[MAXN];
queue<pi> Q;

void dfs(int x, int p, int val){
	int nx = spec[x] + 1;
	nx%=3;
	
	for (auto v:A[x])if(v.f!=p){
		spec[v.f] = nx;
		dfs(v.f,x,1-val);
		out[v.s] = spec[v.f];
	}
}

vi LO;

std::vector<int> Mark(int N, int M, int _A, int _B,
                      std::vector<int> U, std::vector<int> V) {
  //assert(M==N-1);
  //assert(_B == 2*N);
  //assert(_A>=4);
  out.resize(M,0);
  for (int i=0;i<M;++i){
	 int a=U[i];int b=V[i];
	 //cout<<a<<' '<<b<<'\n';
	 A[a].pb(b,i);A[b].pb(a,i);
  }
  dst[0]=1;
  Q.push(mp(0,-1));
  spec[0] = 2;
  
  while (SZ(Q)){
	int t = Q.front().f;
	int p = Q.front().s;
	Q.pop();
	for (auto v:A[t])if(v.f!=p){
		if (dst[v.f]!=0){
			LO.pb(v.s);
		}else{
			spec[v.f] = (1+spec[t])%3;
			out[v.s] = (1+spec[t])%3;
			dst[v.f] = 1+dst[t];
			Q.push(mp(v.f,t));
		}
	}
  }
  sort(ALL(LO));
  LO.resize(unique(ALL(LO)) - LO.begin());
  //cout<<SZ(LO)<<'\n';
  for (auto i:LO){
	 int ind = i;
	 int a = U[ind];
	 int b = V[ind];
	 //cout<<"A entry "<<spec[a]<<' '<<" B entry "<<spec[b]<<' ';
	 
	 if (dst[a] == dst[b]){
		out[ind] = (1+spec[a])%3;
	 }else{
			assert(abs(dst[a] - dst[b]) == 1);
			if (dst[a] > dst[b])swap(a,b);
			out[ind] = (1+spec[a])%3;
	  }
	  //cout<<" out "<<out[ind]<<'\n';
  }
  //for (auto i : out)cout<<i<<' ';cout<<'\n';
  return out;
}
#include "Catherine.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pi;
typedef vector<pi> vpi;
typedef long double ld;
#define pb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ALL(x) x.begin(), x.end()
#define SZ(x) (ll)x.size()
#define f first
#define s second

void Init(int A, int B) {
  
}

stack<int> p;
int fst3 = 1;
int movenum = 0;
deque<int> f6;
int brow[] = {1,0,1,1,0,0};

bool is_wrong(){
	for (int i=0;i<6;++i)if (brow[i] != f6[i])return 0;
	return 1;
}

int Move(std::vector<int> y) {
	int a = y[0];
	int b = y[1];
	int c = y[2];
	if (a>0&&b>0&&c>0){
		assert(0);
		return -1;
	}
	if (a==0&&b==0)return 2;
	if (b==0&&c==0)return 0;
	if (a==0&&c==0)return 1;
	if (a==0)return 1;
	if (b==0)return 2;
	if (c==0)return 0;
}

Compilation message

Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:48:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Correct 60 ms 16244 KB Output is correct
2 Correct 9 ms 1536 KB Output is correct
3 Correct 47 ms 15412 KB Output is correct
4 Correct 70 ms 17228 KB Output is correct
5 Correct 74 ms 17228 KB Output is correct
6 Correct 57 ms 16080 KB Output is correct
7 Correct 66 ms 16200 KB Output is correct
8 Correct 66 ms 16800 KB Output is correct
9 Correct 69 ms 16724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 60 ms 16244 KB Output is correct
2 Correct 9 ms 1536 KB Output is correct
3 Correct 47 ms 15412 KB Output is correct
4 Correct 70 ms 17228 KB Output is correct
5 Correct 74 ms 17228 KB Output is correct
6 Correct 57 ms 16080 KB Output is correct
7 Correct 66 ms 16200 KB Output is correct
8 Correct 66 ms 16800 KB Output is correct
9 Correct 69 ms 16724 KB Output is correct
10 Correct 55 ms 14144 KB Output is correct
11 Correct 64 ms 14260 KB Output is correct
12 Correct 61 ms 14148 KB Output is correct
13 Correct 51 ms 14156 KB Output is correct
14 Correct 69 ms 14464 KB Output is correct
15 Correct 60 ms 14668 KB Output is correct
16 Correct 64 ms 17088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 54 ms 13788 KB Output is correct
2 Correct 9 ms 1536 KB Output is correct
3 Correct 47 ms 13548 KB Output is correct
4 Correct 64 ms 15072 KB Output is correct
5 Correct 64 ms 15252 KB Output is correct
6 Correct 59 ms 13780 KB Output is correct
7 Correct 51 ms 13908 KB Output is correct
8 Correct 59 ms 14604 KB Output is correct
9 Correct 64 ms 14596 KB Output is correct
10 Correct 57 ms 14608 KB Output is correct
11 Correct 55 ms 14344 KB Output is correct
12 Correct 55 ms 14352 KB Output is correct
13 Correct 60 ms 14340 KB Output is correct
14 Correct 59 ms 14572 KB Output is correct
15 Correct 63 ms 14584 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 54 ms 13788 KB Output is correct
2 Correct 9 ms 1536 KB Output is correct
3 Correct 47 ms 13548 KB Output is correct
4 Correct 64 ms 15072 KB Output is correct
5 Correct 64 ms 15252 KB Output is correct
6 Correct 59 ms 13780 KB Output is correct
7 Correct 51 ms 13908 KB Output is correct
8 Correct 59 ms 14604 KB Output is correct
9 Correct 64 ms 14596 KB Output is correct
10 Correct 57 ms 14608 KB Output is correct
11 Correct 55 ms 14344 KB Output is correct
12 Correct 55 ms 14352 KB Output is correct
13 Correct 60 ms 14340 KB Output is correct
14 Correct 59 ms 14572 KB Output is correct
15 Correct 63 ms 14584 KB Output is correct
16 Correct 52 ms 12224 KB Output is correct
17 Correct 51 ms 12352 KB Output is correct
18 Correct 49 ms 12236 KB Output is correct
19 Correct 51 ms 12496 KB Output is correct
20 Correct 63 ms 12908 KB Output is correct
21 Correct 53 ms 12764 KB Output is correct
22 Correct 62 ms 14540 KB Output is correct
23 Correct 50 ms 12492 KB Output is correct
24 Correct 56 ms 12372 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 1792 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 4864 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 4864 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -