답안 #912663

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
912663 2024-01-19T17:28:11 Z MilosMilutinovic 길고양이 (JOI20_stray) C++14
15 / 100
40 ms 18040 KB
#include "Anthony.h"
#include<bits/stdc++.h>

using namespace std;

namespace {
int n,tot;
int v[40005],nxt[40005],h[20005],d[20005],q[20005];

void addedge(int x,int y){
	v[++tot]=y; nxt[tot]=h[x]; h[x]=tot;
	v[++tot]=x; nxt[tot]=h[y]; h[y]=tot;
}

void bfs(){
	for(int i=0;i<n;i++) d[i]=-1;
	int front=0,rear=0;
	q[rear++]=0; d[0]=0;
	while(front<rear){
		int x=q[front];
		for(int p=h[x];p;p=nxt[p]){
			if(d[v[p]]==-1){
				d[v[p]]=d[x]+1;
				q[rear++]=v[p];
			}
		}
		++front;
	}
}
}

vector<int> Mark(int n,int m,int a,int b,vector<int> u,vector<int> v){
	::n=n;
	for(int i=0;i<m;i++) addedge(u[i],v[i]);
	if(a>=3){
		bfs();
		vector<int> col(m);
		for(int i=0;i<m;i++) col[i]=min(d[u[i]],d[v[i]])%3;
		return col;
	}
	return vector<int>(m,0);
}
#include "Catherine.h"
#include<bits/stdc++.h>

using namespace std;

namespace {

int a,b;
}  // namespace

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

int Move(vector<int> y){
	int cnt=0;
	for(int i=0;i<a;i++) cnt+=(y[i]>0?1:0);
	if(cnt==1){
		for(int i=0;i<a;i++) if(y[i]>0) return i;
	}
	for(int i=0;i<a;i++){
		if(y[i]>0&&y[(i+1)%3]>0) return i;
	}
}

Compilation message

Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:24:1: warning: control reaches end of non-void function [-Wreturn-type]
   24 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 14972 KB Output is correct
2 Correct 1 ms 800 KB Output is correct
3 Correct 23 ms 14640 KB Output is correct
4 Correct 35 ms 16532 KB Output is correct
5 Correct 40 ms 16520 KB Output is correct
6 Correct 28 ms 15176 KB Output is correct
7 Correct 27 ms 15172 KB Output is correct
8 Correct 31 ms 15792 KB Output is correct
9 Correct 35 ms 15784 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 14972 KB Output is correct
2 Correct 1 ms 800 KB Output is correct
3 Correct 23 ms 14640 KB Output is correct
4 Correct 35 ms 16532 KB Output is correct
5 Correct 40 ms 16520 KB Output is correct
6 Correct 28 ms 15176 KB Output is correct
7 Correct 27 ms 15172 KB Output is correct
8 Correct 31 ms 15792 KB Output is correct
9 Correct 35 ms 15784 KB Output is correct
10 Correct 23 ms 13216 KB Output is correct
11 Correct 24 ms 13200 KB Output is correct
12 Correct 24 ms 13156 KB Output is correct
13 Correct 24 ms 13204 KB Output is correct
14 Correct 26 ms 13640 KB Output is correct
15 Correct 31 ms 13988 KB Output is correct
16 Correct 31 ms 15904 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 12412 KB Output is correct
2 Correct 0 ms 788 KB Output is correct
3 Correct 24 ms 12372 KB Output is correct
4 Correct 31 ms 14368 KB Output is correct
5 Correct 35 ms 14148 KB Output is correct
6 Correct 26 ms 12876 KB Output is correct
7 Correct 24 ms 12876 KB Output is correct
8 Correct 39 ms 13864 KB Output is correct
9 Correct 28 ms 13652 KB Output is correct
10 Correct 27 ms 13396 KB Output is correct
11 Correct 28 ms 13344 KB Output is correct
12 Correct 28 ms 13396 KB Output is correct
13 Correct 31 ms 13384 KB Output is correct
14 Correct 34 ms 13480 KB Output is correct
15 Correct 28 ms 13528 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 12412 KB Output is correct
2 Correct 0 ms 788 KB Output is correct
3 Correct 24 ms 12372 KB Output is correct
4 Correct 31 ms 14368 KB Output is correct
5 Correct 35 ms 14148 KB Output is correct
6 Correct 26 ms 12876 KB Output is correct
7 Correct 24 ms 12876 KB Output is correct
8 Correct 39 ms 13864 KB Output is correct
9 Correct 28 ms 13652 KB Output is correct
10 Correct 27 ms 13396 KB Output is correct
11 Correct 28 ms 13344 KB Output is correct
12 Correct 28 ms 13396 KB Output is correct
13 Correct 31 ms 13384 KB Output is correct
14 Correct 34 ms 13480 KB Output is correct
15 Correct 28 ms 13528 KB Output is correct
16 Correct 23 ms 11328 KB Output is correct
17 Correct 22 ms 11328 KB Output is correct
18 Correct 23 ms 11344 KB Output is correct
19 Correct 23 ms 11336 KB Output is correct
20 Correct 27 ms 12076 KB Output is correct
21 Correct 25 ms 11788 KB Output is correct
22 Correct 30 ms 13892 KB Output is correct
23 Correct 25 ms 11600 KB Output is correct
24 Correct 24 ms 11816 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 1296 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 27 ms 18040 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 26 ms 18020 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -