답안 #427619

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
427619 2021-06-14T17:54:35 Z amunduzbaev 길고양이 (JOI20_stray) C++14
0 / 100
71 ms 14052 KB
#include "Anthony.h"
#include "bits/stdc++.h"
using namespace std;

#define ff first
#define ss second
#define pb push_back
#define sz(x) (int)x.size()

const int N = 2e4+5;

namespace sol1{
	
	vector<int> res;
	vector<int> patt = {1, 0, 0, 1, 1, 0};
	vector<pair<int, int>> edges[N];
	
	
	void dfs(int u, int p = -1, int cur = 0, int in = 0){
		for(auto x : edges[u]){
			if(x.ff == p) continue;
			if(sz(edges[u]) == 2){
				res[x.ss] = patt[in];
				dfs(x.ff, u, res[x.ss], (in + 1) % 6);
			} else {
				res[x.ss] = cur ^ 1;
				if(cur) dfs(x.ff, u, cur ^ 1, 1);
				else dfs(x.ff, u, cur ^ 1, 2);
			}
		}
	}
	
	vector<int> Mark1(int n, int m, int a, int b, vector<int> u, vector<int> v){
		res.resize(m);
		for(int i=0;i<m;i++){
			int a = u[i] + 1, b = v[i] + 1;
			edges[a].pb({b, i}), edges[b].pb({a, i});
			res[i] = -1;
		} 
		
		edges[1].pb({-1, -1});
		dfs(1);
		
		//~ for(int i=0;i<m;i++) cout<<res[i]<<" ";
		//~ cout<<"\n";
		
		return res;
	}
}

namespace sol2{
	vector<int> Mark2(int n, int m, int a, int b, vector<int> u, vector<int> v){
		return {};
	}
}

vector<int> Mark(int n, int m, int a, int b, vector<int> u, vector<int> v) {
	if(a == 2) {
		return sol1::Mark1(n, m, a, b, u, v);
	} else {
		return sol2::Mark2(n, m, a, b, u, v);
	}
}
#include "Catherine.h"
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define sz(x) (int)x.size()

vector<int> path;
int a;

void Init(int a, int b) { ::a = a; }

namespace sol1{
	vector<int> ppat = {1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0};
	int ok = 0, last = -1;
	vector<int> path;
	
	int Move(vector<int> y){
		if(ok){
			assert(~last);
			if(y[0] + y[1] + 1 > 2) return last ^= 1;
			if(y[0] == 0) return last = 1;
			if(y[1] == 0) return last = 0;
			assert(0); 
		}
		
		if(y[0] + y[1] + (last != -1) > 2){
			ok = 1;
			if(~last){
				if(min(y[0], y[1]) == 0) return -1;
				if(min(y[0], y[1]) == 1) return last ^= 1;
				assert(0);
			} else {
				if(y[0] == 1) return last = 0;
				if(y[1] == 1) return last = 1;
				assert(0);
			}
		} 
		
		if(y[0] + y[1] + (last != -1) == 1){
			ok = 1;
			if(y[0] == 1) return last = 0;
			if(y[1] == 1) return last = 1;
			return -1;
		}
		
		if(last == -1){
			if(y[0] == 2) { path.pb(0), path.pb(0); return last = 0; }
			else if(y[1] == 2) { path.pb(1), path.pb(1); return last = 1; }
			else { path.pb(0), path.pb(1); return last = 1; }
		} else {
			if(y[0] == 1) last = 0, path.pb(0);
			if(y[1] == 1) last = 1, path.pb(1);
			
			if(sz(path) == 5){ ok = 1; 
				for(int i=0;i+5<=sz(ppat);i++){
					int l = i, r = i + 5 - 1, okk = 1;
					for(int j=l;j<=r;j++) okk &= (ppat[j] == path[j-i]);
					if(okk) return -1;
				} if(y[0]) return last = 0;
				else return last = 1;
			} else return last;
		}
	} 
}

namespace sol2{
	int Move(vector<int> y){
		return 0;
	} 
}

int Move(vector<int> y) {
	if(a == 2) return sol1::Move(y);
	else return sol2::Move(y);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 9 ms 1516 KB Wrong Answer [1]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 9 ms 1516 KB Wrong Answer [1]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 1312 KB Wrong Answer [1]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 1312 KB Wrong Answer [1]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 1260 KB Output is correct
2 Correct 2 ms 1008 KB Output is correct
3 Correct 2 ms 1260 KB Output is correct
4 Correct 3 ms 1256 KB Output is correct
5 Correct 3 ms 1264 KB Output is correct
6 Correct 2 ms 1260 KB Output is correct
7 Correct 2 ms 1260 KB Output is correct
8 Correct 2 ms 1336 KB Output is correct
9 Correct 2 ms 1260 KB Output is correct
10 Correct 2 ms 1316 KB Output is correct
11 Correct 2 ms 1260 KB Output is correct
12 Correct 2 ms 1260 KB Output is correct
13 Correct 2 ms 1268 KB Output is correct
14 Correct 2 ms 1260 KB Output is correct
15 Correct 2 ms 1216 KB Output is correct
16 Correct 2 ms 1256 KB Output is correct
17 Correct 2 ms 1204 KB Output is correct
18 Correct 4 ms 1256 KB Output is correct
19 Correct 3 ms 1264 KB Output is correct
20 Correct 3 ms 1260 KB Output is correct
21 Correct 3 ms 1256 KB Output is correct
22 Correct 2 ms 1260 KB Output is correct
23 Correct 3 ms 1260 KB Output is correct
24 Correct 2 ms 1260 KB Output is correct
25 Correct 2 ms 1260 KB Output is correct
26 Incorrect 3 ms 1260 KB Wrong Answer [5]
27 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 47 ms 11204 KB Output is correct
2 Correct 46 ms 12484 KB Output is correct
3 Correct 2 ms 1008 KB Output is correct
4 Correct 45 ms 11144 KB Output is correct
5 Correct 66 ms 13928 KB Output is correct
6 Correct 59 ms 13876 KB Output is correct
7 Correct 51 ms 13108 KB Output is correct
8 Correct 51 ms 13196 KB Output is correct
9 Correct 62 ms 14052 KB Output is correct
10 Correct 71 ms 13912 KB Output is correct
11 Correct 58 ms 13992 KB Output is correct
12 Correct 52 ms 13972 KB Output is correct
13 Correct 63 ms 13984 KB Output is correct
14 Correct 71 ms 13952 KB Output is correct
15 Correct 53 ms 13944 KB Output is correct
16 Correct 53 ms 13984 KB Output is correct
17 Correct 49 ms 13660 KB Output is correct
18 Correct 50 ms 13736 KB Output is correct
19 Correct 52 ms 13712 KB Output is correct
20 Correct 58 ms 13572 KB Output is correct
21 Correct 66 ms 13672 KB Output is correct
22 Correct 53 ms 13584 KB Output is correct
23 Correct 46 ms 11208 KB Output is correct
24 Correct 39 ms 11276 KB Output is correct
25 Correct 43 ms 11744 KB Output is correct
26 Correct 40 ms 11568 KB Output is correct
27 Correct 52 ms 12584 KB Output is correct
28 Correct 50 ms 12476 KB Output is correct
29 Correct 46 ms 12532 KB Output is correct
30 Correct 47 ms 12644 KB Output is correct
31 Correct 40 ms 11372 KB Output is correct
32 Correct 45 ms 11184 KB Output is correct
33 Correct 45 ms 11580 KB Output is correct
34 Correct 47 ms 11736 KB Output is correct
35 Incorrect 49 ms 12032 KB Wrong Answer [5]
36 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 47 ms 11340 KB Output is correct
2 Correct 48 ms 12184 KB Output is correct
3 Correct 2 ms 1000 KB Output is correct
4 Correct 34 ms 11156 KB Output is correct
5 Correct 52 ms 13972 KB Output is correct
6 Correct 56 ms 14032 KB Output is correct
7 Correct 55 ms 13080 KB Output is correct
8 Correct 48 ms 13068 KB Output is correct
9 Correct 56 ms 13912 KB Output is correct
10 Correct 69 ms 13916 KB Output is correct
11 Correct 49 ms 13984 KB Output is correct
12 Correct 53 ms 13976 KB Output is correct
13 Correct 62 ms 13944 KB Output is correct
14 Correct 55 ms 13964 KB Output is correct
15 Correct 52 ms 13924 KB Output is correct
16 Correct 55 ms 13984 KB Output is correct
17 Correct 70 ms 13692 KB Output is correct
18 Correct 48 ms 13712 KB Output is correct
19 Correct 65 ms 13700 KB Output is correct
20 Correct 55 ms 13640 KB Output is correct
21 Correct 46 ms 13624 KB Output is correct
22 Correct 51 ms 13720 KB Output is correct
23 Incorrect 38 ms 11268 KB Wrong Answer [5]
24 Halted 0 ms 0 KB -