Submission #1012835

# Submission time Handle Problem Language Result Execution time Memory
1012835 2024-07-02T16:42:46 Z Ivo_12 Stray Cat (JOI20_stray) C++17
20 / 100
44 ms 17032 KB
#include "Anthony.h"
#include <bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define pii pair < int, int >
#define FIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;

namespace {

const int N = 2e4+10, M = 2e4+10, A = 4;

vector < pii > edges[N];
vector < int > oznake;
int dis[N];
queue < int > q;

vector < int > mark( int n, int m, int a, int b, vector < int > t1, vector < int > t2 ) {
	for(int i = 0; i < m; i++) {
		edges[t1[i]].pb(mp(t2[i], i));
		edges[t2[i]].pb(mp(t1[i], i));
		oznake.pb(-1);
	}
	dis[0] = 1;
	q.push(0);
	int cur;
	int sus;
	while(!q.empty()) {
		cur = q.front();
		q.pop();
		for(int i = 0; i < (int) edges[cur].size(); i++) {
			sus = edges[cur][i].F;
			if(dis[sus] == 0) {
				q.push(sus);
				dis[sus] = dis[cur]+1;
			}
		}
	}
	if(a>=3) {
		q.push(0);
		while(!q.empty()) {
			cur = q.front();
			q.pop();
			for(int i = 0; i < (int) edges[cur].size(); i++) {
				sus = edges[cur][i].F;
				if(oznake[edges[cur][i].S] == -1) {
					if(dis[sus] > dis[cur]) q.push(sus);
					oznake[edges[cur][i].S] = (dis[cur] - 1) % 3;
				}
			}
		}
	}
	else {
		q.push(0);
		while(!q.empty()) {
			cur = q.front();
			q.pop();
			for(int i = 0; i < (int) edges[cur].size(); i++) {
				sus = edges[cur][i].F;
				if(oznake[edges[cur][i].S] == -1) {
					if(dis[sus] > dis[cur]) q.push(sus);
					oznake[edges[cur][i].S] = (dis[cur] - 1) % 2;
				}
			}
		}
	}
	
	return oznake;
}

}  // namespace

std::vector<int> Mark(int N, int M, int A, int B,
                      std::vector<int> U, std::vector<int> V) {
  std::vector<int> X(M);
  return ::mark(N, M, A, B, U, V);
}
#include "Catherine.h"
#include <bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define pii pair < int, int >
#define FIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;

namespace {

int ga, gb;
int l[2];

void init( int a, int b ) {
	ga = a;
	gb = b;
	l[0] = 0;
	l[1] = 0;
}

int move( vector < int > v ) {
	
	if(::ga>=3) {
		if(v[0] && v[1]) return 0;
		if(v[2] && v[0]) return 2;
		if(v[1] && v[2]) return 1;
		if(!(v[0] || v[1])) return 2;
		if(!(v[2] || v[0])) return 1;
		if(!(v[1] || v[2])) return 0;
	}
	
	if(v[0] == 0 && v[1] == 0) return -1;
	if(v[0] == 0 && v[1] > 1) {
		return -1;
	}
	if(v[0] > 1 && v[1] == 0) {
		return -1;
	}
	if(v[0] == 0 && v[1] == 1) {
		l[1] = 1;
		l[0] = 0;
		return 1;
	}
	if(v[0] == 1 && v[1] == 0) {
		l[1] = 0;
		l[0] = 1;
		return 0;
	}
	if(l[0]) {
		l[1] = 1;
		l[0] = 0;
		return 1;
	}
	if(l[1]) {
		l[1] = 0;
		l[0] = 1;
		return 0;
	}
	if(v[0] > v[1]) {
		l[1] = 1;
		l[0] = 0;
		return 1;
	}
	l[1] = 0;
	l[0] = 1;
	return 0;
	
}

}  // namespace

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

int Move(std::vector<int> y) {
	return ::move(y);
}
# Verdict Execution time Memory Grader output
1 Correct 30 ms 15952 KB Output is correct
2 Correct 1 ms 1292 KB Output is correct
3 Correct 18 ms 15276 KB Output is correct
4 Correct 28 ms 17032 KB Output is correct
5 Correct 29 ms 17020 KB Output is correct
6 Correct 22 ms 15752 KB Output is correct
7 Correct 23 ms 15680 KB Output is correct
8 Correct 24 ms 16512 KB Output is correct
9 Correct 28 ms 16512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 30 ms 15952 KB Output is correct
2 Correct 1 ms 1292 KB Output is correct
3 Correct 18 ms 15276 KB Output is correct
4 Correct 28 ms 17032 KB Output is correct
5 Correct 29 ms 17020 KB Output is correct
6 Correct 22 ms 15752 KB Output is correct
7 Correct 23 ms 15680 KB Output is correct
8 Correct 24 ms 16512 KB Output is correct
9 Correct 28 ms 16512 KB Output is correct
10 Correct 22 ms 13688 KB Output is correct
11 Correct 19 ms 13780 KB Output is correct
12 Correct 26 ms 13952 KB Output is correct
13 Correct 23 ms 13956 KB Output is correct
14 Correct 30 ms 14052 KB Output is correct
15 Correct 25 ms 14468 KB Output is correct
16 Correct 30 ms 16508 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 13588 KB Output is correct
2 Correct 0 ms 1308 KB Output is correct
3 Correct 19 ms 13180 KB Output is correct
4 Correct 36 ms 14696 KB Output is correct
5 Correct 27 ms 14800 KB Output is correct
6 Correct 24 ms 13512 KB Output is correct
7 Correct 24 ms 13448 KB Output is correct
8 Correct 30 ms 14296 KB Output is correct
9 Correct 35 ms 14216 KB Output is correct
10 Correct 25 ms 13960 KB Output is correct
11 Correct 24 ms 13960 KB Output is correct
12 Correct 33 ms 13928 KB Output is correct
13 Correct 25 ms 13972 KB Output is correct
14 Correct 25 ms 14216 KB Output is correct
15 Correct 28 ms 14320 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 13588 KB Output is correct
2 Correct 0 ms 1308 KB Output is correct
3 Correct 19 ms 13180 KB Output is correct
4 Correct 36 ms 14696 KB Output is correct
5 Correct 27 ms 14800 KB Output is correct
6 Correct 24 ms 13512 KB Output is correct
7 Correct 24 ms 13448 KB Output is correct
8 Correct 30 ms 14296 KB Output is correct
9 Correct 35 ms 14216 KB Output is correct
10 Correct 25 ms 13960 KB Output is correct
11 Correct 24 ms 13960 KB Output is correct
12 Correct 33 ms 13928 KB Output is correct
13 Correct 25 ms 13972 KB Output is correct
14 Correct 25 ms 14216 KB Output is correct
15 Correct 28 ms 14320 KB Output is correct
16 Correct 19 ms 12160 KB Output is correct
17 Correct 24 ms 11900 KB Output is correct
18 Correct 25 ms 11912 KB Output is correct
19 Correct 30 ms 11876 KB Output is correct
20 Correct 22 ms 12636 KB Output is correct
21 Correct 23 ms 12428 KB Output is correct
22 Correct 25 ms 14464 KB Output is correct
23 Correct 22 ms 12172 KB Output is correct
24 Correct 23 ms 12128 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1552 KB Output is correct
2 Correct 1 ms 1308 KB Output is correct
3 Correct 1 ms 1568 KB Output is correct
4 Correct 2 ms 1556 KB Output is correct
5 Correct 2 ms 1564 KB Output is correct
6 Correct 1 ms 1568 KB Output is correct
7 Correct 1 ms 1572 KB Output is correct
8 Correct 2 ms 1568 KB Output is correct
9 Correct 1 ms 1572 KB Output is correct
10 Correct 2 ms 1572 KB Output is correct
11 Correct 1 ms 1572 KB Output is correct
12 Correct 2 ms 1564 KB Output is correct
13 Correct 1 ms 1564 KB Output is correct
14 Correct 2 ms 1564 KB Output is correct
15 Correct 1 ms 1564 KB Output is correct
16 Correct 1 ms 1572 KB Output is correct
17 Correct 2 ms 1572 KB Output is correct
18 Correct 2 ms 1564 KB Output is correct
19 Correct 1 ms 1628 KB Output is correct
20 Correct 2 ms 1572 KB Output is correct
21 Correct 2 ms 1560 KB Output is correct
22 Correct 2 ms 1564 KB Output is correct
23 Correct 2 ms 1572 KB Output is correct
24 Correct 1 ms 1568 KB Output is correct
25 Correct 1 ms 1572 KB Output is correct
26 Correct 1 ms 1564 KB Output is correct
27 Correct 2 ms 1564 KB Output is correct
28 Correct 1 ms 1572 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 11724 KB Output is correct
2 Correct 44 ms 12532 KB Output is correct
3 Correct 0 ms 1308 KB Output is correct
4 Correct 16 ms 11824 KB Output is correct
5 Correct 26 ms 13668 KB Output is correct
6 Correct 27 ms 13664 KB Output is correct
7 Correct 22 ms 12800 KB Output is correct
8 Incorrect 22 ms 12876 KB Wrong Answer [6]
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 22 ms 11664 KB Output is correct
2 Correct 21 ms 12152 KB Output is correct
3 Correct 1 ms 1296 KB Output is correct
4 Correct 18 ms 11832 KB Output is correct
5 Correct 27 ms 13580 KB Output is correct
6 Correct 33 ms 13624 KB Output is correct
7 Correct 23 ms 12868 KB Output is correct
8 Incorrect 22 ms 12844 KB Wrong Answer [6]
9 Halted 0 ms 0 KB -