Submission #768323

#TimeUsernameProblemLanguageResultExecution timeMemory
768323raysh07Airline Route Map (JOI18_airline)C++17
0 / 100
302 ms15212 KiB
#include "Alicelib.h" #include <bits/stdc++.h> using namespace std; void Alice( int N, int M, int A[], int B[] ){ // InitG( 3, 2 ); // MakeG( 1, 2 ); // MakeG( 1, 3 ); int n = N + 12; vector <pair<int, int>> e; for (int i = 0; i < M; i++){ e.push_back({A[i], B[i]}); } for (int i = 0; i < n - 1; i++){ if (i != N) e.push_back({i, N}); } for (int i = N + 1; i <= N + 10; i++) e.push_back({i, n - 1}); for (int i = N + 2; i <= N + 9; i++) e.push_back({i, N + 10}); for (int i = N = 2; i <= N + 9; i++) e.push_back({i, i - 1}); InitG(n, (int)e.size()); int curr = 0; for (auto [x, y] : e) MakeG(curr++, x, y); }
#include "Boblib.h" #include <bits/stdc++.h> using namespace std; void Bob(int V, int U, int C[], int D[]){ // InitMap( 3, 2 ); // MakeMap( 1, 2 ); // MakeMap( 1, 3 ); int n = V- 12; vector<vector<bool>> has(V, vector<bool>(V, false)); vector<int> deg(V, 0); for (int i = 0; i < U; i++){ has[C[i]][D[i]] = true; has[D[i]][C[i]] = true; deg[C[i]]++; deg[D[i]]++; } pair<int, int> mx = {-1, -1}; for (int i = 0; i < V; i++){ mx = max(mx, {deg[i], i}); } vector<pair<int, int>> e; set<int> bruh; int orz = -1; for (int i = 0; i < V; i++){ if (i != mx.second && !has[i][mx.second]){ assert(orz == -1); orz = i; } } for (int i = 0; i < V; i++){ if (has[orz][i]){ bruh.insert(i); } } assert(bruh.size() == 10); vector <int> okie(V, 0); for (int i = 0; i < V; i++){ for (int j = i + 1; j < V; j++){ if (bruh.find(i) != bruh.end() && bruh.find(j) != bruh.end() && has[i][j]){ okie[i]++; okie[j]++; } } } vector <int> fin(10, -1); vector <bool> used(V, false); used[orz] = true; used[mx.second] = true; for (int i = 0; i < V; i++){ if (okie[i] == 8) fin[9] = i; if (okie[i] == 1) fin[0] = i; } int curr = fin[0]; used[fin[0]] = true; used[fin[9]] = true; int ptr = 1; while (true){ int nc = -1; for (int i = 0; i < V; i++){ if (bruh.find(i) != bruh.end() && has[curr][i] && !used[i]){ nc = i; break; } } if (nc == -1) break; used[nc] = true; fin[ptr++] = nc; curr = nc; } vector <int> ac(V, 0); for (int i = 0; i < V; i++){ if (used[i]) continue; for (int j = 0; j < 10; j++){ if (has[i][fin[j]]){ ac[i] += (1 << j); } } } for (int i = 0; i < V; i++){ for (int j = i + 1; j < V; j++){ if (!used[i] && !used[j] && has[i][j]){ e.push_back({i, j}); } } } InitMap(n, (int)e.size()); for (auto [x, y] : e) MakeMap(x, y); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...