Submission #503198

#TimeUsernameProblemLanguageResultExecution timeMemory
503198sidonAirline Route Map (JOI18_airline)C++17
100 / 100
744 ms25568 KiB
#include "Alicelib.h" #include <bits/stdc++.h> using namespace std; void Alice(int N, int M, int *A, int *B) { vector<pair<int, int>> G; for(int i = 1; i <= N; ++i) for(int j = 0; j < 10; ++j) if((i >> j) & 1) G.emplace_back(N+j, i-1); for(int k = 0; k < 3; ++k) for(int j = k>1; j < (!k)*N+10; ++j) G.emplace_back((k>0)*N+j, N+(k ? (k & 1 ? 10 : j-1) : 11)); InitG(N + 12, size(G) + M); for(int i = 0; i < M; ++i) MakeG(i, A[i], B[i]); for(auto &[u, v] : G) MakeG(M++, u, v); }
#include "Boblib.h" #include <bits/stdc++.h> using namespace std; void Bob(int N, int M, int *A, int *B){ int org = 0, d[N] = {}, p[N] = {}, R, f = -1; vector<int> G[N]; for(int i = 0; i < M; ++i) G[A[i]].push_back(B[i]), G[B[i]].push_back(A[i]); for(int i = 0; i < N; ++i) if(size(G[i]) > size(G[org])) org = i; for(int u = 0; u < N; ++u) { bool ok = u == org; for(int v : G[org]) if(v == u) ok = 1; if(!ok) R = u; } for(int u : G[R]) ++d[u], p[u] = p[R] = p[org] = -2e5; for(int u : G[R]) for(int v : G[u]) if(d[v]) ++d[u]; for(int u : G[R]) if(d[u] < 3 && ((int)size(G[u]) - 3) == (N-11)/2) d[f = u] = 0; for(int j = 0, nxt; j < 10; ++j, d[f] = 0, f = nxt) for(int v : G[f]) d[v] ? nxt = v : p[v] += 1<<j; vector<pair<int, int>> E; for(int i = 0; i < M; ++i) if(min(p[A[i]], p[B[i]]) > 0) E.emplace_back(p[A[i]]-1, p[B[i]]-1); InitMap(N-12, size(E)); for(auto &[u, v] : E) MakeMap(u, v); }

Compilation message (stderr)

Bob.cpp: In function 'void Bob(int, int, int*, int*)':
Bob.cpp:31:17: warning: 'nxt' may be used uninitialized in this function [-Wmaybe-uninitialized]
   31 |  for(int j = 0, nxt; j < 10; ++j, d[f] = 0, f = nxt)
      |                 ^~~
Bob.cpp:7:37: warning: 'R' may be used uninitialized in this function [-Wmaybe-uninitialized]
    7 |  int org = 0, d[N] = {}, p[N] = {}, R, f = -1;
      |                                     ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...