Submission #949500

# Submission time Handle Problem Language Result Execution time Memory
949500 2024-03-19T09:49:35 Z Cyber_Wolf Airline Route Map (JOI18_airline) C++17
37 / 100
950 ms 77936 KB
#include <bits/stdc++.h>
#include <cassert>
#include <cstdio>
#include "Alicelib.h"

using namespace std;

void Alice( int N, int M, int A[], int B[] ){
	vector<array<int, 2>> v;
	for(int i = 0; i < M; i++)
	{
		v.push_back({A[i], B[i]});
	}
	for(int i = 0; i < N; i++)
	{
		for(int j = 0; j < 10; j++)
		{
			if((1ll << j)&i)	v.push_back({N+j, i});
		}
		v.push_back({N+10, i});
		v.push_back({N+11, i});
	}
	for(int i = 0; i < 10; i++)
	{
		v.push_back({N+10, N+i});
		if(i)	v.push_back({N+i-1, N+i});
	}
	InitG(N+12, v.size());
	for(int i = 0; i < v.size(); i++)
	{ 
		MakeG(i, v[i][0], v[i][1]);
	}
}

#include <bits/stdc++.h>
#include <cassert>
#include <cstdio>
#include "Boblib.h"

using namespace std;

void Bob( int V, int U, int C[], int D[] ){
	int N = V-12;
	vector<int> deg(V), loc(V);
	vector<set<int>>adj(V);
	vector<array<int, 2>> nodes(V);
	int mxm = 0;
	for(int i = 0; i < U; i++)
	{
		deg[C[i]]++;
		deg[D[i]]++;
		adj[C[i]].insert(D[i]);
		adj[D[i]].insert(C[i]);
	}
	for(int i = 0; i < V; i++)
	{
		nodes[i][1] = i;
		loc[i] = i;
		if(deg[mxm] < deg[i])	mxm = i;
	}
	nodes[mxm][0] = N+10;
	for(int i = 0; i < V; i++)
	{
		if(mxm == i)	continue;
		if(adj[mxm].find(i) == adj[mxm].end())
		{
			nodes[loc[i]][0] = N+11;
		}
	}
	sort(nodes.begin(), nodes.end());
	for(int i = 0; i < V; i++)
	{
		loc[nodes[i][1]] = i;
	}
	int cur = -1;
	for(int i = 0; i < V-2; i++)
	{
		if(adj[nodes[N+11][1]].find(nodes[i][1]) != adj[nodes[N+11][1]].end())	continue;
		if(nodes[i][0])	continue;
		if(cur == -1 || deg[cur] > deg[nodes[i][1]])	
		{
			cur = nodes[i][1];
		}
	}
	vector<array<int, 2>> v;
	int cnt = N+9;
	while(cnt >= N)
	{
		nodes[loc[cur]][0] = cnt;
		for(auto it : adj[cur])
		{
			if(nodes[loc[it]][0])	continue;
			if(adj[nodes[N+11][1]].find(it) != adj[nodes[N+11][1]].end())	continue;
			cur = it;
			break;
		}
		cnt--;
	}
	sort(nodes.begin(), nodes.end());
	for(int i = 0; i < V; i++)
	{
		loc[nodes[i][1]] = i;
	}
	for(int i = 0; i < N; i++)
	{
		for(int j = 0; j < 10; j++)
		{
			if(adj[nodes[i][1]].find(nodes[N+j][1]) != adj[nodes[i][1]].end())
			{
				nodes[i][0] |= (1ll << j);
			}
		}
	}
	sort(nodes.begin(), nodes.end());
	for(int i = 0; i < V; i++)
	{
		loc[nodes[i][1]] = i;
	}
	for(int i = 0; i < U; i++)
	{
		if(nodes[loc[C[i]]][0] >= N || nodes[loc[D[i]]][0] >= N)	continue;
		v.push_back({nodes[loc[C[i]]][0], nodes[loc[D[i]]][0]});
	}
	InitMap(N, v.size());
	for(auto [a, b] : v)	MakeMap(a, b);
}


Compilation message

Alice.cpp: In function 'void Alice(int, int, int*, int*)':
Alice.cpp:29:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::array<int, 2> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |  for(int i = 0; i < v.size(); i++)
      |                 ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 15620 KB Output is correct
2 Correct 3 ms 15620 KB Output is correct
3 Correct 2 ms 15620 KB Output is correct
4 Correct 2 ms 13576 KB Output is correct
5 Correct 2 ms 15620 KB Output is correct
6 Correct 3 ms 15616 KB Output is correct
7 Correct 2 ms 15620 KB Output is correct
8 Correct 3 ms 15616 KB Output is correct
9 Correct 3 ms 15616 KB Output is correct
10 Correct 2 ms 13572 KB Output is correct
11 Correct 3 ms 15620 KB Output is correct
12 Correct 2 ms 15620 KB Output is correct
13 Correct 3 ms 15620 KB Output is correct
14 Correct 3 ms 15620 KB Output is correct
15 Correct 3 ms 15620 KB Output is correct
16 Correct 3 ms 15616 KB Output is correct
17 Correct 3 ms 15620 KB Output is correct
18 Correct 3 ms 15624 KB Output is correct
19 Correct 3 ms 15620 KB Output is correct
20 Correct 3 ms 15616 KB Output is correct
21 Correct 3 ms 15620 KB Output is correct
22 Correct 2 ms 15620 KB Output is correct
23 Correct 3 ms 15632 KB Output is correct
24 Correct 2 ms 13572 KB Output is correct
25 Correct 2 ms 15620 KB Output is correct
26 Correct 2 ms 15616 KB Output is correct
27 Correct 2 ms 15616 KB Output is correct
28 Correct 3 ms 15616 KB Output is correct
29 Correct 2 ms 15616 KB Output is correct
30 Correct 2 ms 13412 KB Output is correct
31 Correct 2 ms 13568 KB Output is correct
32 Correct 2 ms 13572 KB Output is correct
33 Correct 2 ms 13568 KB Output is correct
34 Correct 2 ms 13564 KB Output is correct
35 Correct 2 ms 13572 KB Output is correct
36 Correct 3 ms 15620 KB Output is correct
37 Correct 3 ms 15620 KB Output is correct
38 Correct 3 ms 15616 KB Output is correct
39 Correct 3 ms 15620 KB Output is correct
40 Correct 3 ms 15612 KB Output is correct
41 Correct 2 ms 15620 KB Output is correct
42 Correct 3 ms 15620 KB Output is correct
43 Correct 2 ms 15620 KB Output is correct
44 Correct 2 ms 13572 KB Output is correct
45 Correct 2 ms 13572 KB Output is correct
46 Correct 2 ms 15620 KB Output is correct
47 Correct 3 ms 15620 KB Output is correct
48 Correct 2 ms 15616 KB Output is correct
49 Correct 3 ms 15616 KB Output is correct
50 Correct 2 ms 13572 KB Output is correct
51 Correct 2 ms 13576 KB Output is correct
52 Correct 3 ms 15624 KB Output is correct
53 Correct 2 ms 13572 KB Output is correct
54 Correct 3 ms 15620 KB Output is correct
55 Correct 3 ms 15620 KB Output is correct
56 Correct 3 ms 15616 KB Output is correct
57 Correct 3 ms 15620 KB Output is correct
58 Correct 2 ms 15620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 15620 KB Output is correct
2 Correct 3 ms 15620 KB Output is correct
3 Correct 2 ms 15620 KB Output is correct
4 Correct 2 ms 13576 KB Output is correct
5 Correct 2 ms 15620 KB Output is correct
6 Correct 3 ms 15616 KB Output is correct
7 Correct 2 ms 15620 KB Output is correct
8 Correct 3 ms 15616 KB Output is correct
9 Correct 3 ms 15616 KB Output is correct
10 Correct 2 ms 13572 KB Output is correct
11 Correct 3 ms 15620 KB Output is correct
12 Correct 2 ms 15620 KB Output is correct
13 Correct 3 ms 15620 KB Output is correct
14 Correct 3 ms 15620 KB Output is correct
15 Correct 3 ms 15620 KB Output is correct
16 Correct 3 ms 15616 KB Output is correct
17 Correct 3 ms 15620 KB Output is correct
18 Correct 3 ms 15624 KB Output is correct
19 Correct 3 ms 15620 KB Output is correct
20 Correct 3 ms 15616 KB Output is correct
21 Correct 3 ms 15620 KB Output is correct
22 Correct 2 ms 15620 KB Output is correct
23 Correct 3 ms 15632 KB Output is correct
24 Correct 2 ms 13572 KB Output is correct
25 Correct 2 ms 15620 KB Output is correct
26 Correct 2 ms 15616 KB Output is correct
27 Correct 2 ms 15616 KB Output is correct
28 Correct 3 ms 15616 KB Output is correct
29 Correct 2 ms 15616 KB Output is correct
30 Correct 2 ms 13412 KB Output is correct
31 Correct 2 ms 13568 KB Output is correct
32 Correct 2 ms 13572 KB Output is correct
33 Correct 2 ms 13568 KB Output is correct
34 Correct 2 ms 13564 KB Output is correct
35 Correct 2 ms 13572 KB Output is correct
36 Correct 3 ms 15620 KB Output is correct
37 Correct 3 ms 15620 KB Output is correct
38 Correct 3 ms 15616 KB Output is correct
39 Correct 3 ms 15620 KB Output is correct
40 Correct 3 ms 15612 KB Output is correct
41 Correct 2 ms 15620 KB Output is correct
42 Correct 3 ms 15620 KB Output is correct
43 Correct 2 ms 15620 KB Output is correct
44 Correct 2 ms 13572 KB Output is correct
45 Correct 2 ms 13572 KB Output is correct
46 Correct 2 ms 15620 KB Output is correct
47 Correct 3 ms 15620 KB Output is correct
48 Correct 2 ms 15616 KB Output is correct
49 Correct 3 ms 15616 KB Output is correct
50 Correct 2 ms 13572 KB Output is correct
51 Correct 2 ms 13576 KB Output is correct
52 Correct 3 ms 15624 KB Output is correct
53 Correct 2 ms 13572 KB Output is correct
54 Correct 3 ms 15620 KB Output is correct
55 Correct 3 ms 15620 KB Output is correct
56 Correct 3 ms 15616 KB Output is correct
57 Correct 3 ms 15620 KB Output is correct
58 Correct 2 ms 15620 KB Output is correct
59 Correct 3 ms 15620 KB Output is correct
60 Correct 3 ms 15620 KB Output is correct
61 Correct 3 ms 15612 KB Output is correct
62 Correct 3 ms 15620 KB Output is correct
63 Correct 2 ms 15620 KB Output is correct
64 Correct 2 ms 15620 KB Output is correct
65 Correct 3 ms 15620 KB Output is correct
66 Correct 3 ms 15620 KB Output is correct
67 Correct 3 ms 15616 KB Output is correct
68 Correct 3 ms 15616 KB Output is correct
69 Correct 2 ms 15620 KB Output is correct
70 Correct 3 ms 15628 KB Output is correct
71 Correct 3 ms 15616 KB Output is correct
72 Correct 3 ms 15620 KB Output is correct
73 Correct 3 ms 15620 KB Output is correct
74 Correct 3 ms 15612 KB Output is correct
75 Correct 2 ms 15616 KB Output is correct
76 Correct 3 ms 15616 KB Output is correct
77 Correct 3 ms 15620 KB Output is correct
78 Correct 3 ms 15620 KB Output is correct
79 Correct 3 ms 15460 KB Output is correct
80 Correct 3 ms 15620 KB Output is correct
81 Correct 3 ms 15620 KB Output is correct
82 Correct 3 ms 15616 KB Output is correct
83 Correct 2 ms 15632 KB Output is correct
84 Correct 3 ms 15620 KB Output is correct
85 Correct 3 ms 15620 KB Output is correct
86 Correct 3 ms 15620 KB Output is correct
87 Correct 3 ms 15616 KB Output is correct
88 Correct 2 ms 15616 KB Output is correct
89 Correct 3 ms 13572 KB Output is correct
90 Correct 2 ms 13568 KB Output is correct
91 Correct 2 ms 13568 KB Output is correct
92 Correct 2 ms 13572 KB Output is correct
93 Correct 2 ms 13572 KB Output is correct
94 Correct 3 ms 15620 KB Output is correct
95 Correct 3 ms 15620 KB Output is correct
96 Correct 3 ms 15624 KB Output is correct
97 Correct 3 ms 15620 KB Output is correct
98 Correct 3 ms 15620 KB Output is correct
99 Correct 3 ms 15620 KB Output is correct
100 Correct 3 ms 15620 KB Output is correct
101 Correct 3 ms 15624 KB Output is correct
102 Correct 3 ms 13580 KB Output is correct
103 Correct 3 ms 15620 KB Output is correct
104 Correct 3 ms 15616 KB Output is correct
105 Correct 3 ms 15620 KB Output is correct
106 Correct 3 ms 15848 KB Output is correct
107 Correct 3 ms 16124 KB Output is correct
108 Correct 2 ms 15620 KB Output is correct
109 Correct 4 ms 15648 KB Output is correct
110 Correct 3 ms 15616 KB Output is correct
111 Correct 3 ms 15620 KB Output is correct
112 Correct 3 ms 15620 KB Output is correct
113 Correct 2 ms 15616 KB Output is correct
114 Correct 3 ms 15620 KB Output is correct
115 Correct 3 ms 15620 KB Output is correct
116 Correct 2 ms 15620 KB Output is correct
117 Correct 3 ms 15620 KB Output is correct
118 Correct 3 ms 15620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 950 ms 77936 KB Wrong Answer [11]
2 Halted 0 ms 0 KB -