답안 #1081379

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1081379 2024-08-30T02:30:21 Z thelegendary08 The Ties That Guide Us (CEOI23_incursion) C++17
12 / 100
270 ms 7916 KB
#include <bits/stdc++.h>
#include "incursion.h"
#define f0r(i,n) for(int i = 0;i<n;i++)
#define vi vector<int>
using namespace std;

std::vector<int> mark(std::vector<std::pair<int, int>> F, int safe) {
    safe--;
	int n;
	n = F.size() + 1;
	vector<int>dist(n);
	dist[safe] = 0;
	vector<int>adj[n];
	f0r(i, n-1){
		adj[--F[i].first].push_back(--F[i].second);
		adj[F[i].second].push_back(F[i].first);
	}
	queue<int>q;
	q.push(safe);
	vector<bool>vis(n,0);
	vis[safe] = 1;
	vi col(n);
	col[safe] = 0;
	while(!q.empty()){
		int cur = q.front();
		q.pop();
		for(auto u : adj[cur]){
			if(vis[u])continue;
			vis[u] = 1;
			dist[u] = dist[cur] + 1;
			col[u] = (col[cur] + 1) % 3;
			q.push(u);
		}
	}

  	return col;
}

void locate(std::vector<std::pair<int, int>> F, int curr, int t) {
	int x;
	vector<int>nxt = {2, 0, 1};
	int n = F.size() + 1;
	vector<bool>vis(n+1, 0);
	vector<int>adj[n+1];
	f0r(i, n-1){
		adj[F[i].first].push_back(F[i].second);
		adj[F[i].second].push_back(F[i].first);
	}
	vis[curr] = 1;
	//queue<int>q;
	//q.push(curr);
	bool found = false;
	int col = t;
	int cur = curr;
	vi cols(n+1, -1);
	cols[curr] = t;
	while(!found){
		bool ok = 0;
		for(auto u : adj[cur]){
			if(vis[u])continue;
			vis[u] = 1;
			x = visit(u);
			cols[u] = x;
			if(x == nxt[cols[cur]]){
				cur = u;
				ok = 1;
				break;
			}
			else{
				visit(cur);
			}
		}
		if(!ok)return;
	}


}

Compilation message

incursion.cpp: In function 'void locate(std::vector<std::pair<int, int> >, int, int)':
incursion.cpp:53:6: warning: unused variable 'col' [-Wunused-variable]
   53 |  int col = t;
      |      ^~~
interface.cpp: In function 'int main()':
interface.cpp:44:55: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   44 |     if(fread(T.data(), sizeof(int), 2 * N - 2, stdin) != 2 * N - 2) exit(0);
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
interface.cpp:50:33: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   50 |         int l = (numbers.size() == N ? N : 0);
      |                  ~~~~~~~~~~~~~~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 776 KB Partially correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 197 ms 7696 KB Partially correct
2 Partially correct 241 ms 7552 KB Partially correct
3 Partially correct 106 ms 7624 KB Partially correct
4 Partially correct 94 ms 7516 KB Partially correct
5 Partially correct 216 ms 7916 KB Partially correct
6 Partially correct 73 ms 7508 KB Partially correct
7 Partially correct 81 ms 7584 KB Partially correct
8 Partially correct 206 ms 7700 KB Partially correct
9 Partially correct 211 ms 7628 KB Partially correct
10 Partially correct 146 ms 7696 KB Partially correct
11 Partially correct 85 ms 7512 KB Partially correct
12 Partially correct 270 ms 7620 KB Partially correct
13 Partially correct 76 ms 7544 KB Partially correct
14 Partially correct 73 ms 7580 KB Partially correct
15 Partially correct 203 ms 7696 KB Partially correct
16 Partially correct 209 ms 7704 KB Partially correct
17 Partially correct 137 ms 7632 KB Partially correct
18 Partially correct 94 ms 7624 KB Partially correct
19 Partially correct 149 ms 7688 KB Partially correct
20 Partially correct 68 ms 7524 KB Partially correct
21 Partially correct 74 ms 7584 KB Partially correct
22 Partially correct 199 ms 7608 KB Partially correct
23 Partially correct 228 ms 7620 KB Partially correct
24 Partially correct 101 ms 7448 KB Partially correct
25 Partially correct 76 ms 7580 KB Partially correct
26 Partially correct 81 ms 7456 KB Partially correct
27 Partially correct 70 ms 7584 KB Partially correct
28 Partially correct 80 ms 7668 KB Partially correct
29 Partially correct 221 ms 7760 KB Partially correct
30 Partially correct 214 ms 7696 KB Partially correct
31 Partially correct 86 ms 7520 KB Partially correct
32 Partially correct 218 ms 7636 KB Partially correct
33 Partially correct 238 ms 7840 KB Partially correct
34 Partially correct 72 ms 7584 KB Partially correct
35 Partially correct 76 ms 7584 KB Partially correct
36 Partially correct 205 ms 7696 KB Partially correct
37 Partially correct 217 ms 7624 KB Partially correct
38 Partially correct 232 ms 7700 KB Partially correct
39 Partially correct 155 ms 7660 KB Partially correct
40 Partially correct 178 ms 7700 KB Partially correct
41 Partially correct 75 ms 7580 KB Partially correct
42 Partially correct 80 ms 7584 KB Partially correct
43 Partially correct 200 ms 7692 KB Partially correct
44 Partially correct 205 ms 7688 KB Partially correct
45 Partially correct 80 ms 7520 KB Partially correct
46 Partially correct 77 ms 7520 KB Partially correct
47 Partially correct 95 ms 7508 KB Partially correct
48 Partially correct 72 ms 7512 KB Partially correct
49 Partially correct 77 ms 7524 KB Partially correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 76 ms 7444 KB Partially correct
2 Incorrect 81 ms 7412 KB Not correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 776 KB Partially correct
2 Partially correct 197 ms 7696 KB Partially correct
3 Partially correct 241 ms 7552 KB Partially correct
4 Partially correct 106 ms 7624 KB Partially correct
5 Partially correct 94 ms 7516 KB Partially correct
6 Partially correct 216 ms 7916 KB Partially correct
7 Partially correct 73 ms 7508 KB Partially correct
8 Partially correct 81 ms 7584 KB Partially correct
9 Partially correct 206 ms 7700 KB Partially correct
10 Partially correct 211 ms 7628 KB Partially correct
11 Partially correct 146 ms 7696 KB Partially correct
12 Partially correct 85 ms 7512 KB Partially correct
13 Partially correct 270 ms 7620 KB Partially correct
14 Partially correct 76 ms 7544 KB Partially correct
15 Partially correct 73 ms 7580 KB Partially correct
16 Partially correct 203 ms 7696 KB Partially correct
17 Partially correct 209 ms 7704 KB Partially correct
18 Partially correct 137 ms 7632 KB Partially correct
19 Partially correct 94 ms 7624 KB Partially correct
20 Partially correct 149 ms 7688 KB Partially correct
21 Partially correct 68 ms 7524 KB Partially correct
22 Partially correct 74 ms 7584 KB Partially correct
23 Partially correct 199 ms 7608 KB Partially correct
24 Partially correct 228 ms 7620 KB Partially correct
25 Partially correct 101 ms 7448 KB Partially correct
26 Partially correct 76 ms 7580 KB Partially correct
27 Partially correct 81 ms 7456 KB Partially correct
28 Partially correct 70 ms 7584 KB Partially correct
29 Partially correct 80 ms 7668 KB Partially correct
30 Partially correct 221 ms 7760 KB Partially correct
31 Partially correct 214 ms 7696 KB Partially correct
32 Partially correct 86 ms 7520 KB Partially correct
33 Partially correct 218 ms 7636 KB Partially correct
34 Partially correct 238 ms 7840 KB Partially correct
35 Partially correct 72 ms 7584 KB Partially correct
36 Partially correct 76 ms 7584 KB Partially correct
37 Partially correct 205 ms 7696 KB Partially correct
38 Partially correct 217 ms 7624 KB Partially correct
39 Partially correct 232 ms 7700 KB Partially correct
40 Partially correct 155 ms 7660 KB Partially correct
41 Partially correct 178 ms 7700 KB Partially correct
42 Partially correct 75 ms 7580 KB Partially correct
43 Partially correct 80 ms 7584 KB Partially correct
44 Partially correct 200 ms 7692 KB Partially correct
45 Partially correct 205 ms 7688 KB Partially correct
46 Partially correct 80 ms 7520 KB Partially correct
47 Partially correct 77 ms 7520 KB Partially correct
48 Partially correct 95 ms 7508 KB Partially correct
49 Partially correct 72 ms 7512 KB Partially correct
50 Partially correct 77 ms 7524 KB Partially correct
51 Partially correct 76 ms 7444 KB Partially correct
52 Incorrect 81 ms 7412 KB Not correct
53 Halted 0 ms 0 KB -