Submission #933917

#TimeUsernameProblemLanguageResultExecution timeMemory
933917alexander707070Airline Route Map (JOI18_airline)C++14
0 / 100
426 ms39964 KiB
#include<bits/stdc++.h> #include "Alicelib.h" #define MAXN 2007 using namespace std; int n,m,num; vector< pair<int,int> > edges; void Alice( int N, int M, int A[], int B[]){ srand(42070); n=N; m=M; num=17; for(int i=0;i<n;i++){ for(int f=10;f>=0;f--){ if(((1<<f)&(i+num))>0)edges.push_back({i,n+f}); } } for(int i=n;i<=n+10;i++){ edges.push_back({i,n+11}); if(i<n+10)edges.push_back({i,i+1}); } for(int i=0;i<m;i++){ edges.push_back({A[i],B[i]}); } InitG( n+12, edges.size() ); for(int i=0;i<edges.size();i++){ MakeG(i,edges[i].first,edges[i].second); } }
#include <bits/stdc++.h> #include "Boblib.h" #define MAXN 2007 using namespace std; namespace{ int v,u,e,cnt,root,curr; vector<int> g[MAXN],w,line[MAXN]; int sp[MAXN],tim; vector<int> path; vector< pair<int,int> > ed; int used2[MAXN],tim2,pos[MAXN],to[MAXN]; bool dali; void dfs(int x,int p){ path.push_back(x); for(int i=0;i<line[x].size();i++){ if(line[x][i]==p)continue; dfs(line[x][i],x); } } bool ok(int x){ w.clear(); tim++; e=0; for(int i=0;i<g[x].size();i++){ w.push_back(g[x][i]); sp[w.back()]=tim; line[w.back()].clear(); } for(int i=0;i<w.size();i++){ for(int f:g[w[i]]){ if(sp[f]==tim and f>w[i]){ e++; line[w[i]].push_back(f); line[f].push_back(w[i]); } } } if(e!=w.size()-1)return false; cnt=0; for(int i=0;i<w.size();i++){ if(line[w[i]].size()!=1 and line[w[i]].size()!=2)return false; if(line[w[i]].size()==1){ cnt++; root=w[i]; } } if(cnt!=2)return false; path.clear(); dfs(root,0); for(int i=0;i<path.size();i++){ pos[path[i]]=i; } tim2++; dali=true; for(int f=0;f<v;f++){ if(f==x or sp[f]==tim)continue; curr=0; for(int k:g[f]){ if(sp[k]!=tim)continue; curr+=(1<<pos[k]); } to[f]=curr; if(used2[curr]==tim2 or curr<17 or curr>=v-12+17){dali=false;break;} used2[curr]=tim2; } if(dali)return true; reverse(path.begin(),path.end()); for(int i=0;i<path.size();i++){ pos[path[i]]=i; } tim2++; dali=true; for(int f=0;f<v;f++){ if(f==x or sp[f]==tim)continue; curr=0; for(int k:g[f]){ if(sp[k]!=tim)continue; curr+=(1<<pos[k]); } to[f]=curr; if(used2[curr]==tim2 or curr<17 or curr>=v-12+17){dali=false;break;} used2[curr]=tim2; } if(dali)return true; return false; } } void Bob( int V, int U, int C[], int D[] ){ v=V; u=U; for(int i=0;i<u;i++){ g[C[i]].push_back(D[i]); g[D[i]].push_back(C[i]); } for(int i=0;i<v;i++){ if(g[i].size()==11 and ok(i)){ e=0; for(int f=0;f<u;f++){ if(sp[C[f]]==tim or sp[D[f]]==tim)continue; ed.push_back({to[C[f]]-17,to[D[f]]-17}); e++; } InitMap(V-12,e); for(int f=0;f<ed.size();f++){ MakeMap(ed[i].first,ed[i].second); } return; } } }

Compilation message (stderr)

Alice.cpp: In function 'void Alice(int, int, int*, int*)':
Alice.cpp:33: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]
   33 |  for(int i=0;i<edges.size();i++){
      |              ~^~~~~~~~~~~~~

Bob.cpp: In function 'void {anonymous}::dfs(int, int)':
Bob.cpp:19:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |   for(int i=0;i<line[x].size();i++){
      |               ~^~~~~~~~~~~~~~~
Bob.cpp: In function 'bool {anonymous}::ok(int)':
Bob.cpp:28:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |   for(int i=0;i<g[x].size();i++){
      |               ~^~~~~~~~~~~~
Bob.cpp:35:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |   for(int i=0;i<w.size();i++){
      |               ~^~~~~~~~~
Bob.cpp:46:7: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |   if(e!=w.size()-1)return false;
      |      ~^~~~~~~~~~~~
Bob.cpp:49:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |   for(int i=0;i<w.size();i++){
      |               ~^~~~~~~~~
Bob.cpp:59:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   59 |   for(int i=0;i<path.size();i++){
      |               ~^~~~~~~~~~~~
Bob.cpp:82:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   82 |   for(int i=0;i<path.size();i++){
      |               ~^~~~~~~~~~~~
Bob.cpp: In function 'void Bob(int, int, int*, int*)':
Bob.cpp:125:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  125 |    for(int f=0;f<ed.size();f++){
      |                ~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...