답안 #1081400

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1081400 2024-08-30T04:05:02 Z LCJLY 길고양이 (JOI20_stray) C++14
0 / 100
38 ms 20472 KB
#include "Anthony.h"
#include <bits/stdc++.h>
using namespace std;

//#define int long long 
//#define ld long double
#define show(x,y) cout << y << " " << #x << endl;
#define show2(x,y,i,j) cout << y << " " << #x << "  " << j << " " << #i << endl;
#define show3(x,y,i,j,p,q) cout << y << " " << #x << "  " << j << " " << #i << "  " << q << " " << #p << endl;
#define show4(x,y) for(auto it:y) cout << it << " "; cout << #x << endl;
typedef pair<int,int>pii;
typedef pair<pii,int>pi2;

vector<int>adj[200005];
int d[200005];
bool visited[200005];

void dfs(int index, int par){
	visited[index]=true;
	for(auto it:adj[index]){
		if(it==par) continue;
		if(visited[it]) continue;
		d[it]=d[index]+1;
		dfs(it,index);
	}
}

vector<int>Mark(int N, int M, int A, int B, vector<int>U, vector<int>V) {
	vector<int>ans(M);
	for(int x=0;x<M;x++){
		adj[U[x]].push_back(V[x]);
		adj[V[x]].push_back(U[x]);
	}
	
	dfs(0,-1);
	
	for(int x=0;x<M;x++){
		int hold=max(d[U[x]],d[V[x]]);
		ans[x]=hold%3;
	}
	return ans;
}
#include "Catherine.h"
#include <bits/stdc++.h>
using namespace std;

//#define int long long 
//#define ld long double
#define show(x,y) cout << y << " " << #x << endl;
#define show2(x,y,i,j) cout << y << " " << #x << "  " << j << " " << #i << endl;
#define show3(x,y,i,j,p,q) cout << y << " " << #x << "  " << j << " " << #i << "  " << q << " " << #p << endl;
#define show4(x,y) for(auto it:y) cout << it << " "; cout << #x << endl;
typedef pair<int,int>pii;
typedef pair<pii,int>pi2;

void Init(int A, int B){
}

int Move(vector<int>y){
	vector<int>one;
	for(auto it:y){
		if(it==1) one.push_back(it);
	}
	sort(one.begin(),one.end());
	if(one.empty()) return -1;
	if(one.size()==1) return one[0];
	else{
		if(one[0]==1&&one[1]==2){
			return 1;
		}
		else if(one[0]==0&&one[1]==2){
			return 2;
		}
		else return 0;
	}
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 38 ms 20472 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 38 ms 20472 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 27 ms 18380 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 27 ms 18380 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 5404 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 10 ms 7092 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 11 ms 7088 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -