Submission #991869

#TimeUsernameProblemLanguageResultExecution timeMemory
991869simona1230Airline Route Map (JOI18_airline)C++17
37 / 100
231 ms20232 KiB
#include <bits/stdc++.h> #include "Alicelib.h" using namespace std; void Alice(int n,int m,int a[],int b[]) { vector<pair<int,int> > v; int l[1024]; int num=0; for(int i=0;i<n;i++) { int cnt=i+3; l[i]=num; for(int j=1;j<cnt;j++) { v.push_back({num,num+1}); num++; } v.push_back({num,num-cnt+1}); num++; v.push_back({l[i],num}); l[i]=num; num++; //cout<<l[i]<<" "; } //cout<<endl; for(int i=0;i<m;i++) { v.push_back({l[a[i]],l[b[i]]}); } //cout<<"* "<<num<<endl; InitG(num,v.size()); for(int i=0;i<v.size();i++) { int x=min(v[i].first,v[i].second); int y=max(v[i].first,v[i].second); //cout<<x<<" - "<<y<<endl; MakeG(i,x,y); } }
#include <bits/stdc++.h> #include "Boblib.h" using namespace std; int x[100001],y[100001]; vector<int> e[100001]; int used[100001]; int l[100001]; int maxx=0; void dfs(int i,int c,int bg,int p) { //cout<<i<<"->"<<c<<endl; used[i]=1; for(int j=0;j<e[i].size();j++) { int nb=e[i][j]; if(e[nb].size()==2&&nb!=p&&!used[nb])dfs(nb,c+1,bg,i); else if(nb!=p&&nb==bg) { maxx=max(maxx,c-2); for(int k=0;k<e[bg].size();k++) { if(used[e[bg][k]]!=1) { //cout<<"in "<<e[bg][k]<<endl; l[e[nb][k]]=c-2; return; } } } } used[i]=2; } void Bob(int v,int u,int c[],int d[]) { //cout<<v<<" ------ "<<u<<endl; for(int i=0;i<u;i++) { e[c[i]].push_back(d[i]); e[d[i]].push_back(c[i]); //cout<<c[i]<<" "<<d[i]<<endl; } //cout<<v<<" ------ "<<u<<endl; for(int i=0;i<v;i++) { //cout<<v<<" "<<i<<" "<<e[i].size()<<endl; if(e[i].size()==3)dfs(i,1,i,-1); //cout<<"out "<<endl; } vector<pair<int,int> > ans; for(int i=0;i<u;i++) { if(l[c[i]]&&l[d[i]]) ans.push_back({l[c[i]]-1,l[d[i]]-1}); } InitMap(maxx,ans.size()); for(int i=0;i<ans.size();i++) MakeMap(ans[i].first,ans[i].second); }

Compilation message (stderr)

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

Bob.cpp: In function 'void dfs(int, int, int, int)':
Bob.cpp:15:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     for(int j=0;j<e[i].size();j++)
      |                 ~^~~~~~~~~~~~
Bob.cpp:22:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |             for(int k=0;k<e[bg].size();k++)
      |                         ~^~~~~~~~~~~~~
Bob.cpp: In function 'void Bob(int, int, int*, int*)':
Bob.cpp:62:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   62 |     for(int i=0;i<ans.size();i++)
      |                 ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...