Submission #988153

#TimeUsernameProblemLanguageResultExecution timeMemory
988153boyliguanhanAirline Route Map (JOI18_airline)C++17
0 / 100
631 ms39992 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>>EEE; for(int i=0;i<M;i++) EEE.push_back({A[i],B[i]}); EEE.push_back({N,N+1}); for(int i=0;i<10;i++) EEE.push_back({N+1,N+i+2}); for(int i=0;i<9;i++) EEE.push_back({N+2+i,N+3+i}); EEE.push_back({N+8,N+11}); EEE.push_back({N+8,N+10}); EEE.push_back({N+7,N+9}); int cnt=0; for(int i=3;cnt<N;i++){ if(__builtin_popcount(i)>1){ for(int j=0;j<10;j++) if(i&1<<j) EEE.push_back({cnt,N+2+j}); cnt++; } } InitG(N+12,EEE.size()); for(int i=0;i<EEE.size();i++) MakeG(i,EEE[i].first,EEE[i].second); }
#include "Boblib.h" #include <bits/stdc++.h> using namespace std; #define CTD(D,I) for(auto i:adj[z]) if(IN[i]&&i-w&&DEG[i]==D&&i!=v[I]){w=z,v.push_back(z=i);break;} vector<int>adj[1012]; int means[1024],val[1012],DEG[1012],IN[1012]; void Bob( int V, int U, int C[], int D[] ){ int CC=0; for(int i=3;i<1024;i++) if(__builtin_popcount(i)>1) means[i]=CC++; for(int i=0;i<U;i++) adj[C[i]].push_back(D[i]), adj[D[i]].push_back(C[i]); int x,y,z,w; for(int i=0;i<V;i++) if(adj[i].size()<2) x=i; y=adj[x][0]; for(auto j:adj[y]) IN[j]=1; for(int i=0;i<V;i++) for(auto j:adj[i]) DEG[i]+=IN[j]; for(auto i:adj[y]) if(DEG[i]==1) z=i; vector<int>v{z}; for(int Q=5;Q--;)for(auto i:adj[z]) if(IN[i]&&i-w){w=z,v.push_back(z=i);break;} for(auto i:adj[z]) CTD(4,0) for(auto i:adj[z]) for(auto i:adj[z]) if(IN[i]&&i-w&&DEG[i]==3&&count(adj[i].begin(),adj[i].end(),v[5])){ w=z,v.push_back(z=i);break;} for(auto i:adj[z]) CTD(3,5) for(auto i:adj[z]) CTD(2,0) for(int i=0;i<10;i++) for(auto j:adj[v[i]]) val[j]+=1<<i; vector<pair<int,int>>EEE; for(int i=0;i<U;i++) if(!IN[C[i]]&&!IN[D[i]]) { int A=means[val[C[i]]],B=means[val[D[i]]]; EEE.push_back({A,B}); } swap(EEE.back(),EEE[0]); InitMap(V-12,EEE.size()); for(auto[i,j]:EEE) MakeMap(i,j); }

Compilation message (stderr)

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

Bob.cpp: In function 'void Bob(int, int, int*, int*)':
Bob.cpp:31:11: warning: unused variable 'i' [-Wunused-variable]
   31 |  for(auto i:adj[z]) CTD(4,0)
      |           ^
Bob.cpp:32:11: warning: unused variable 'i' [-Wunused-variable]
   32 |  for(auto i:adj[z]) for(auto i:adj[z])
      |           ^
Bob.cpp:35:11: warning: unused variable 'i' [-Wunused-variable]
   35 |  for(auto i:adj[z]) CTD(3,5)
      |           ^
Bob.cpp:36:11: warning: unused variable 'i' [-Wunused-variable]
   36 |  for(auto i:adj[z]) CTD(2,0)
      |           ^
Bob.cpp:30:11: warning: 'w' may be used uninitialized in this function [-Wmaybe-uninitialized]
   30 |   if(IN[i]&&i-w){w=z,v.push_back(z=i);break;}
      |      ~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...