Submission #212217

# Submission time Handle Problem Language Result Execution time Memory
212217 2020-03-22T14:13:27 Z bensonlzl Stray Cat (JOI20_stray) C++14
15 / 100
98 ms 17212 KB
#include "Anthony.h"
#include <bits/stdc++.h>

using namespace std;

typedef pair<int,int> pi;

namespace {

	int dist[20005];
	vector<int> edges;
	vector<pi> AdjList[20005];
	queue<int> q;

}  // namespace

vector<int> Mark(int N, int M, int A, int B,vector<int> U,vector<int> V) {
	for (int i = 0; i < N; ++i){
		dist[i] = 1e9;
		AdjList[i].clear();
	}
	edges.resize(M,-1);
	for (int i = 0; i < M; ++i){
		AdjList[U[i]].push_back(pi(V[i],i));
		AdjList[V[i]].push_back(pi(U[i],i));
	}
	dist[0] = 0;
	q.push(0);
	while (!q.empty()){
		int x = q.front();
		q.pop();
		for (auto it : AdjList[x]){

			if (edges[it.second] != -1) continue;
			if (dist[it.first] > dist[x] + 1){
				dist[it.first] = dist[x] + 1;
				q.push(it.first);
			}
			edges[it.second] = dist[x]%A;
			//cerr << x << ' ' << it.first << ' ' << edges[it.second] << '\n';
		}
	}
	/*
	for (auto it : edges){
		cerr << it << ' ';
	}
	cerr << '\n';
	*/
	return edges;
}
#include "Catherine.h"
#include <bits/stdc++.h>

using namespace std;

typedef pair<int,int> pi;

namespace {
	int A;
	vector<int> a0 = {0,1};
	vector<int> a1 = {1,2};
	vector<int> a2 = {2,3};
	vector<int> a3 = {0,3};
	vector<int> b0 = {0,1};
	vector<int> b1 = {1,2};
	vector<int> b2 = {0,2};
}  // namespace

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

int Move(std::vector<int> y) {
	/*
	for (auto it : y){
		cerr << it << ' ';
	}
	cerr << "\n\n";
	*/
	vector<int> x;
	for (int i = 0; i < y.size(); ++i){
		if (y[i]) x.push_back(i);
	}
	assert(x.size() <= 2);
	if (x.size() == 1) return x[0];
	if (::A == 3){
		if (x == b0){
			return 0;
		}
		if (x == b1){
			return 1;
		}
		if (x == b2){
			return 2;
		}
	}
	if (::A == 4){
		if (x == a0){
			return 0;
		}
		if (x == a1){
			return 1;
		}
		if (x == a2){
			return 2;
		}
		if (x == a3){
			return 3;
		}
	}
	
}

Compilation message

Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:31:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < y.size(); ++i){
                  ~~^~~~~~~~~~
Catherine.cpp:62:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Correct 74 ms 15780 KB Output is correct
2 Correct 10 ms 1768 KB Output is correct
3 Correct 56 ms 15500 KB Output is correct
4 Correct 71 ms 17212 KB Output is correct
5 Correct 79 ms 17208 KB Output is correct
6 Correct 98 ms 16084 KB Output is correct
7 Correct 57 ms 16024 KB Output is correct
8 Correct 75 ms 16716 KB Output is correct
9 Correct 69 ms 16700 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 74 ms 15780 KB Output is correct
2 Correct 10 ms 1768 KB Output is correct
3 Correct 56 ms 15500 KB Output is correct
4 Correct 71 ms 17212 KB Output is correct
5 Correct 79 ms 17208 KB Output is correct
6 Correct 98 ms 16084 KB Output is correct
7 Correct 57 ms 16024 KB Output is correct
8 Correct 75 ms 16716 KB Output is correct
9 Correct 69 ms 16700 KB Output is correct
10 Correct 52 ms 14016 KB Output is correct
11 Correct 56 ms 14024 KB Output is correct
12 Correct 52 ms 13972 KB Output is correct
13 Correct 59 ms 14020 KB Output is correct
14 Correct 55 ms 14304 KB Output is correct
15 Correct 69 ms 14660 KB Output is correct
16 Correct 69 ms 16804 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 56 ms 13280 KB Output is correct
2 Correct 9 ms 1536 KB Output is correct
3 Correct 49 ms 12884 KB Output is correct
4 Correct 75 ms 14492 KB Output is correct
5 Correct 79 ms 14576 KB Output is correct
6 Correct 55 ms 13732 KB Output is correct
7 Correct 58 ms 13744 KB Output is correct
8 Correct 70 ms 14472 KB Output is correct
9 Correct 73 ms 14304 KB Output is correct
10 Correct 63 ms 14148 KB Output is correct
11 Correct 59 ms 14152 KB Output is correct
12 Correct 79 ms 14292 KB Output is correct
13 Correct 59 ms 14028 KB Output is correct
14 Correct 95 ms 14516 KB Output is correct
15 Correct 71 ms 14760 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 56 ms 13280 KB Output is correct
2 Correct 9 ms 1536 KB Output is correct
3 Correct 49 ms 12884 KB Output is correct
4 Correct 75 ms 14492 KB Output is correct
5 Correct 79 ms 14576 KB Output is correct
6 Correct 55 ms 13732 KB Output is correct
7 Correct 58 ms 13744 KB Output is correct
8 Correct 70 ms 14472 KB Output is correct
9 Correct 73 ms 14304 KB Output is correct
10 Correct 63 ms 14148 KB Output is correct
11 Correct 59 ms 14152 KB Output is correct
12 Correct 79 ms 14292 KB Output is correct
13 Correct 59 ms 14028 KB Output is correct
14 Correct 95 ms 14516 KB Output is correct
15 Correct 71 ms 14760 KB Output is correct
16 Correct 51 ms 12168 KB Output is correct
17 Correct 61 ms 12236 KB Output is correct
18 Correct 55 ms 12228 KB Output is correct
19 Correct 52 ms 12204 KB Output is correct
20 Correct 66 ms 12740 KB Output is correct
21 Correct 74 ms 12492 KB Output is correct
22 Correct 69 ms 14612 KB Output is correct
23 Correct 80 ms 12228 KB Output is correct
24 Correct 56 ms 12312 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 1792 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 49 ms 11504 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 49 ms 11780 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -