답안 #954850

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
954850 2024-03-28T17:23:36 Z Skywk 항공 노선도 (JOI18_airline) C++17
0 / 100
542 ms 40984 KB
#include "Alicelib.h"
#include <cassert>
#include <cstdio>
#include <bits/stdc++.h>

using namespace std;

vector<array<int, 2>> edgesA;

void Alice(int N, int M, int A[], int B[]){
	int supremeNode = N;
	int startNode = N + 11;
	int bitNode[10]; iota(bitNode, bitNode + 10, N + 1);
	
	int V = N + 12;
	for(int i=0; i<M; i++){
		edgesA.push_back({A[i], B[i]});
	}
	for(int i=0; i<N; i++){
		edgesA.push_back({supremeNode, i});
	}
	edgesA.push_back({startNode, supremeNode});
	for(int x=1; x<10; x++){
		edgesA.push_back({bitNode[x], bitNode[x-1]});
	}
	for(int i=0; i<N; i++){
		for(int x=0; x<10; x++){
			if(i & (1 << x)){
				edgesA.push_back({i, bitNode[x]});
			}
		}
	}
	int U = edgesA.size();
	InitG(V, U);
	for(int i=0; i<U; i++){
		MakeG(i, edgesA[i][0], edgesA[i][1]);
	}
}
#include "Boblib.h"
#include <cassert>
#include <cstdio>
#include <bits/stdc++.h>

using namespace std;

const int MAXN = 1000;
vector<int> adj[MAXN + 12];
int degree[MAXN + 12];
int vis[MAXN + 12];
int value[MAXN + 12];
vector<array<int, 2>> edgesB;

void Bob(int V, int U, int C[], int D[]){
	memset(degree, 0, sizeof(degree[0]) * V);
	int N = V - 12;
	for(int i=0; i<U; i++){
		degree[C[i]]++;
		degree[D[i]]++;
		adj[C[i]].push_back(D[i]);
		adj[D[i]].push_back(C[i]);
	}
	int startNode = -1;
	int supremeNode = -1;
	for(int i=0; i<V; i++){
		if(degree[i] == 1 && degree[adj[i][0]] == N + 1){
				startNode = i;
				supremeNode = adj[i][0];
				break;
		}
	}
	memset(vis, 0, sizeof(vis[0]) * V);
	for(auto u : adj[supremeNode]) vis[u] = 1;
	vis[startNode] = 2;
	vis[supremeNode] = 2;
	int bitNode[10], bitEdges[10];
	memset(bitNode, -1, sizeof(bitNode[0]) * 10);
	memset(bitEdges, 0, sizeof(bitEdges[0]) * 10);
	for(int i=0; i<N; i++){
		for(int x=0; x<10; x++){
			bitEdges[x] += (i >> x) & 1;
		}
	}
	for(int i=0; i<V; i++){
		if(!vis[i] && degree[i] == bitEdges[0] + 1){
			bitNode[0] = i;
			vis[i] = 2;
		}
	}
	for(int i=1; i<10; i++){
		for(auto u : adj[bitNode[i-1]]){
			if(vis[u]) continue;
			bitNode[i] = u;
			vis[u] = 2;
		}
	}
	memset(value, 0, sizeof(value[0]) * V);
	for(int i=0; i<10; i++){
		for(auto u : adj[bitNode[i]]){
			if(vis[u] == 1){
				value[u] += (1 << i);
			}
		}
	}
	for(int i=0; i<U; i++){
		if(vis[C[i]] == 1 && vis[D[i]] == 1){
			edgesB.push_back({value[C[i]], value[D[i]]});
		}
	}
	int M = edgesB.size();
	InitMap(N, M);
	for(auto [u, v] : edgesB){
		MakeMap(u, v);
	}
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 15620 KB Wrong Answer [12]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 15620 KB Wrong Answer [12]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 458 ms 40984 KB Output is correct : V - N = 12
2 Correct 474 ms 38236 KB Output is correct : V - N = 12
3 Correct 125 ms 22072 KB Output is correct : V - N = 12
4 Correct 6 ms 16372 KB Output is correct : V - N = 12
5 Correct 65 ms 19136 KB Output is correct : V - N = 12
6 Correct 307 ms 39188 KB Output is correct : V - N = 12
7 Correct 542 ms 39352 KB Output is correct : V - N = 12
8 Correct 497 ms 39756 KB Output is correct : V - N = 12
9 Correct 185 ms 23188 KB Output is correct : V - N = 12
10 Correct 20 ms 17584 KB Output is correct : V - N = 12
11 Correct 46 ms 17904 KB Output is correct : V - N = 12
12 Correct 256 ms 28576 KB Output is correct : V - N = 12
13 Correct 454 ms 38464 KB Output is correct : V - N = 12
14 Correct 393 ms 40760 KB Output is correct : V - N = 12
15 Correct 253 ms 35596 KB Output is correct : V - N = 12
16 Correct 51 ms 18316 KB Output is correct : V - N = 12
17 Correct 11 ms 16940 KB Output is correct : V - N = 12
18 Correct 140 ms 22540 KB Output is correct : V - N = 12
19 Correct 388 ms 38380 KB Output is correct : V - N = 12
20 Correct 439 ms 39552 KB Output is correct : V - N = 12
21 Incorrect 103 ms 20708 KB Wrong Answer [12]
22 Halted 0 ms 0 KB -