Submission #1081493

# Submission time Handle Problem Language Result Execution time Memory
1081493 2024-08-30T05:53:54 Z thelegendary08 Stray Cat (JOI20_stray) C++14
0 / 100
36 ms 16392 KB
#include "Anthony.h"
#include <bits/stdc++.h>
#define f0r(i,n) for(int i = 0; i<n;i++)
#define vi vector<int>
#define pb push_back
using namespace std;



std::vector<int> Mark(int N, int M, int A, int B,
                      std::vector<int> U, std::vector<int> V) {
  	std::vector<int> ret(M, -1);
	vector<pair<int,int>>edges;
	vector<int>adj[N];

	f0r(i, M){
		edges.pb({min(U[i], V[i]), max(U[i], V[i])});
		adj[U[i]].pb(V[i]);
		adj[V[i]].pb(U[i]);
	}
	map<pair<int,int>,int>m;
	f0r(i, M){
		m[edges[i]] = i;
	}
	/*
	vi dist(N, 1e9);
	dist[0] = 0;
	priority_queue<pair<int,int>>q;
	q.push({0, 0});
	while(!q.empty()){
		int node = q.top().second;
		q.pop();
		for(auto u : adj[node]){
			if(dist[u] > dist[node] + 1){
				dist[u] = dist[node] + 1;
				q.push({-dist[u], u]});
			}
		}
	}
	*/
	vi dist(N, 1e9);
	dist[0] = 0;
	queue<int>q;
	q.push(0);
	while(!q.empty()){
		int node = q.front();
		q.pop();
		for(auto u : adj[node]){


			if(dist[u] == 1e9){
				ret[m[{min(u, node), max(u, node)}]] = dist[node] % 2;
				dist[u] =  dist[node] + 1;
				q.push(u);
			}
		}
	}
	f0r(i, M){
		if(ret[i] == -1){
			ret[i] = min(dist[edges[i].first], dist[edges[i].second]) % 2;
		}
	}

  	return ret;
}
#include "Catherine.h"
#include <bits/stdc++.h>
#define f0r(i,n) for(int i = 0; i< n; i++)
#define pb push_back
#define vi vector<int>
using namespace std;
int A, B;

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

int Move(std::vector<int> y) {
  	//set<int>s;
  	if(y[0] == 0 && y[1] == 0)return -1;
  	if(y[0] > 1 && y[1] == 0)return -1;
  	if(y[1] > 1 && y[0] == 0)return -1;
  	if(y[0] > 1 && y[1] == 1)return 1;
  	if(y[1] > 1 && y[0] == 1)return 0;
  	if(y[0] == 1 && y[1] == 1)return 0;
  	if(y[0] == 1 && y[1] == 0)return 0;
  	return 1;
}
# Verdict Execution time Memory Grader output
1 Incorrect 36 ms 16392 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 36 ms 16392 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 33 ms 14380 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 33 ms 14380 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1036 KB Output is correct
2 Correct 1 ms 792 KB Output is correct
3 Correct 2 ms 1044 KB Output is correct
4 Correct 1 ms 1052 KB Output is correct
5 Correct 1 ms 1036 KB Output is correct
6 Correct 2 ms 1052 KB Output is correct
7 Correct 2 ms 1048 KB Output is correct
8 Correct 1 ms 1052 KB Output is correct
9 Correct 2 ms 1052 KB Output is correct
10 Correct 1 ms 1052 KB Output is correct
11 Correct 1 ms 1048 KB Output is correct
12 Incorrect 2 ms 1048 KB Wrong Answer [6]
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 32 ms 12516 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 30 ms 12544 KB Output is correct
2 Incorrect 34 ms 12792 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -