Submission #207186

#TimeUsernameProblemLanguageResultExecution timeMemory
207186nvmdavaAirline Route Map (JOI18_airline)C++17
100 / 100
1682 ms69044 KiB
#include "Alicelib.h" #include <bits/stdc++.h> using namespace std; #define ff first #define ss second vector<pair<int, int> > e; void Alice( int N, int M, int A[], int B[] ){ for(int i = 0; i < M; ++i) e.push_back({A[i], B[i]}); for(int j = 0; j < 10; ++j) for(int i = 0; i < N; ++i) if(i & (1 << j)) e.push_back({N + j, i}); for(int i = 1; i <= 9; ++i){ for(int j = i + 1; j <= 9; ++j){ if(i + j >= 10){ e.push_back({N + i, N + j}); } } } e.push_back({N + 0, N + 5}); for(int i = 0; i < N + 10; ++i) e.push_back({N + 10, i}); for(int i = 0; i < 10; ++i) e.push_back({N + 11, N + i}); InitG(N + 12, e.size()); int t = 0; for(auto& x : e) MakeG(t++, x.ff, x.ss); }
#include "Boblib.h" #include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define N 1505 int deg[N]; int id[N]; set<int> adj[N]; vector<pair<int, int> > v; void Bob( int V, int U, int C[], int D[] ){ for(int i = 0; i < U; ++i){ ++deg[D[i]]; ++deg[C[i]]; adj[C[i]].insert(D[i]); adj[D[i]].insert(C[i]); } int r; for(int i = 0; i < V; ++i){ if(deg[i] == V - 2){ r = i; break; } } int t; for(int i = 0; i < V; ++i){ if(r == i) continue; if(!adj[r].count(i)){ t = i; break; } } id[r] = id[t] = -1; for(int x : adj[t]){ v.push_back({0, x}); } for(int i = 0; i < 10; ++i){ for(int j = 0; j < 10; ++j){ v[i].ff += adj[v[i].ss].count(v[j].ss); } id[v[i].ss] = -1; } sort(v.begin(), v.end()); if(adj[v[0].ss].count(v[9].ss)) swap(v[1], v[0]); if(adj[v[0].ss].count(v[6].ss)) swap(v[6], v[5]); for(int i = 0; i < 10; ++i){ for(auto x : adj[v[i].ss]){ if(id[x] == -1) continue; id[x] |= 1 << i; } } int cnt = 0; for(int i = 0; i < U; ++i){ C[i] = id[C[i]]; D[i] = id[D[i]]; if(C[i] != -1 && D[i] != -1) ++cnt; } InitMap(V - 12, cnt); for(int i = 0; i < U; ++i) if(C[i] != -1 && D[i] != -1) MakeMap(C[i], D[i]); }

Compilation message (stderr)

Bob.cpp: In function 'void Bob(int, int, int*, int*)':
Bob.cpp:23:6: warning: 'r' may be used uninitialized in this function [-Wmaybe-uninitialized]
  int r;
      ^
Bob.cpp:32:6: warning: 't' may be used uninitialized in this function [-Wmaybe-uninitialized]
  int t;
      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...