Submission #265506

#TimeUsernameProblemLanguageResultExecution timeMemory
265506dooweyAirline Route Map (JOI18_airline)C++14
91 / 100
726 ms30928 KiB
#include <bits/stdc++.h> #include "Alicelib.h" #include <cassert> #include <cstdio> using namespace std; typedef pair<int, int> pii; #define fi first #define se second #define mp make_pair void Alice( int N, int M, int A[], int B[] ){ vector<pii> edg; for(int i = 0; i < M ; i ++ ){ edg.push_back(mp(A[i], B[i])); } for(int bit = 1; bit < 11; bit ++ ){ edg.push_back(mp(N + bit - 1, N + bit)); } for(int bit = 0; bit < 11; bit ++ ){ for(int i = 0 ; i < N; i ++ ){ if((i & (1 << bit))){ edg.push_back(mp(N + bit, i)); } } } for(int i = 0; i < N ; i ++ ){ edg.push_back(mp(N + 11, i)); } for(int i = 0 ; i < N + 11; i ++ ){ edg.push_back(mp(i, N + 12)); } InitG(N + 13, (int)edg.size()); for(int i = 0 ; i < edg.size(); i ++ ){ MakeG(i, edg[i].fi, edg[i].se); } }
#include <bits/stdc++.h> #include "Boblib.h" #include <cassert> #include <cstdio> using namespace std; typedef pair<int, int> pii; #define fi first #define se second #define mp make_pair static const int N = 1100; static vector<int> T[N]; static bool hh[N]; static bool gg[N]; static bool vis[N]; static int deg[N]; static int idx[N]; static bool out[N]; void Bob( int V, int U, int C[], int D[] ){ int n = V - 13; int m = U; for(int i = 0 ; i < m; i ++ ){ T[C[i]].push_back(D[i]); T[D[i]].push_back(C[i]); } int vso = -1; for(int i = 0 ; i < V; i ++ ){ if(T[i].size() == n + 11){ vso = i; hh[i]=true; for(auto x : T[i]){ hh[x]=true; } break; } } int al = -1; for(int i = 0 ; i < V; i ++ ){ if(!hh[i]){ al = i; } } gg[vso]=true; for(auto x : T[al]){ gg[x]=true; } gg[al]=true; vector<int> bits; for(int i = 0; i < V; i ++ ){ if(!gg[i]){ bits.push_back(i); } } for(auto x : bits){ for(auto y : T[x]){ if(!gg[y]){ deg[x] ++ ; } else if(y != vso && y != al){ out[x] = true; } } } vector<int> ord; int start = -1; for(auto x : bits){ if(deg[x] == 1 && out[x]){ start = x; } } for(auto x : bits){ if(deg[x] == 1 && start == -1){ start = x; } } for(int i = 0 ; i < bits.size(); i ++ ){ vis[start] = true; ord.push_back(start); if(i + 1 == bits.size()) break; for(auto x : T[start]){ if(gg[x] || vis[x]) continue; start = x; break; } } for(int i = 0 ; i < ord.size(); i ++ ){ for(auto x : T[ord[i]]){ if(gg[x]){ idx[x] += (1 << i); } } } vector<pii> sol; gg[vso]=gg[al]=false; for(int i = 0 ; i < V; i ++ ){ if(!gg[i]) continue; for(auto x : T[i]){ if(!gg[x]) continue; if(idx[i] < idx[x]) sol.push_back(mp(idx[i], idx[x])); } } InitMap(n, sol.size()); for(auto x : sol) MakeMap(x.fi, x.se); }

Compilation message (stderr)

Alice.cpp: In function 'void Alice(int, int, int*, int*)':
Alice.cpp:36:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |     for(int i = 0 ; i < edg.size(); i ++ ){
      |                     ~~^~~~~~~~~~~~

Bob.cpp: In function 'void Bob(int, int, int*, int*)':
Bob.cpp:32:24: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   32 |         if(T[i].size() == n + 11){
      |            ~~~~~~~~~~~~^~~~~~~~~
Bob.cpp:80:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   80 |     for(int i = 0 ; i < bits.size(); i ++ ){
      |                     ~~^~~~~~~~~~~~~
Bob.cpp:83:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   83 |         if(i + 1 == bits.size()) break;
      |            ~~~~~~^~~~~~~~~~~~~~
Bob.cpp:90:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   90 |     for(int i = 0 ; i < ord.size(); i ++ ){
      |                     ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...