Submission #372328

#TimeUsernameProblemLanguageResultExecution timeMemory
372328hoaphat1Airline Route Map (JOI18_airline)C++17
0 / 100
1530 ms1048580 KiB
#include<bits/stdc++.h> using namespace std; #include "Alicelib.h" #include "Boblib.h" void Alice( int N, int M, int A[], int B[] ) { vector<pair<int,int>> edges; for (int i = 0; i < M; i++) edges.emplace_back(A[i], B[i]); for (int i = 0; i < N; i++) { for (int j = 0; j < 10; j++) if (i >> j & 1) edges.emplace_back(N + j, i); } for (int i = 0; i < N; i++) { edges.emplace_back(N + 10, i); } for (int i = 1; 1 < 10; i++) edges.emplace_back(N + i - 1, N + i); edges.emplace_back(N + 11, N + 10); InitG(N + 12, (int) edges.size()); for (int i = 0; i < (int) edges.size(); i++) MakeG(i, edges[i].first, edges[i].second); }
#include<bits/stdc++.h> using namespace std; #include "Alicelib.h" #include "Boblib.h" void Bob(int n, int m, int A[], int B[]){ vector<vector<int>> g(n); for(int i = 0; i < m; i++) { g[A[i]].emplace_back(B[i]); g[B[i]].emplace_back(A[i]); } vector<bool> old(n); int pos; for(int i = 0; i < n; i++) if(g[i].size() == 1 && g[g[i][0]].size() == n - 11) { pos = g[i][0]; for(int x : g[pos]) old[x] = 1; break; } int now = pos; for(int i = 0; i < n; i++) if(i != pos && !old[i] && g[i].size() <= g[now].size()) now = i; int pre = now; vector<int> id(n); for(int i = 9; i >= 0; i--) { for(int x : g[now]) if(old[x]) id[x] += 1 << i; for(int x : g[now]) if(!old[x] && x != pre) { pre = now, now = x; break; } } vector<pair<int,int>> edges; for(int i = 0; i < m; i++) if(old[A[i]] && old[B[i]]) edges.emplace_back(id[A[i]], id[B[i]]); InitMap(n - 12, (int)edges.size()); for(auto& x : edges) MakeMap(x.first, x.second); }

Compilation message (stderr)

Bob.cpp: In function 'void Bob(int, int, int*, int*)':
Bob.cpp:16:70: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   16 |  for(int i = 0; i < n; i++) if(g[i].size() == 1 && g[g[i][0]].size() == n - 11) {
      |                                                    ~~~~~~~~~~~~~~~~~~^~~~~~~~~
Bob.cpp:22:52: warning: 'pos' may be used uninitialized in this function [-Wmaybe-uninitialized]
   22 |  for(int i = 0; i < n; i++) if(i != pos && !old[i] && g[i].size() <= g[now].size()) now = i;
      |                                ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...