Submission #783716

#TimeUsernameProblemLanguageResultExecution timeMemory
783716PoonYaPatAirline Route Map (JOI18_airline)C++14
0 / 100
426 ms29172 KiB
#include "Alicelib.h" #include <bits/stdc++.h> using namespace std; typedef pair<int,int> pii; void Alice( int n, int m, int A[], int B[] ){ vector<pii> v; for (int i=0; i<n; ++i) v.push_back({n,i}); for (int i=n+1; i<=n+11; ++i) v.push_back({i-1,i}); for (int i=0; i<n; ++i) { for (int j=0; j<10; ++j) { if (i&(1<<j)) v.push_back({i,n+2+j}); } } for (int i=0; i<m; ++i) v.push_back({A[i],B[i]}); InitG(n+12,v.size()); for (int i=0; i<v.size(); ++i) MakeG(i,v[i].first,v[i].second); }
#include "Boblib.h" #include <bits/stdc++.h> using namespace std; typedef pair<int,int> pii; int st,nx,re[1020]; vector<int> adj[1020]; bool mark[1020]; void dfs(int x, int par, int val) { int nxt=-1; for (auto s : adj[x]) { if (s==par) continue; if (mark[s]) re[s]+=val; else nxt=s; } if (nxt!=-1) dfs(nxt,x,val*2); } void Bob(int n, int m, int C[], int D[] ){ vector<pii> v; for (int i=0; i<m; ++i) { adj[C[i]].push_back(D[i]); adj[D[i]].push_back(C[i]); } for (int i=0; i<n; ++i) if (adj[i].size()==n-11) st=i; for (auto s : adj[st]) mark[s]=true; for (auto s : adj[st]) { if (adj[s].size()==1) continue; mark[s]=false; for (auto k : adj[s]) mark[s]|=mark[k]; if (!mark[s]) nx=s; } for (auto s : adj[nx]) { if (s!=st) dfs(s,nx,1); } for (int i=0; i<m; ++i) { if (mark[C[i]] && mark[D[i]]) { v.push_back({re[C[i]],re[D[i]]}); } } InitMap(n-12,v.size()); for (auto s : v) MakeMap(s.first,s.second); }

Compilation message (stderr)

Alice.cpp: In function 'void Alice(int, int, int*, int*)':
Alice.cpp:17: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]
   17 |  for (int i=0; i<v.size(); ++i) MakeG(i,v[i].first,v[i].second);
      |                ~^~~~~~~~~

Bob.cpp: In function 'void Bob(int, int, int*, int*)':
Bob.cpp:26:43: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   26 |  for (int i=0; i<n; ++i) if (adj[i].size()==n-11) st=i;
      |                              ~~~~~~~~~~~~~^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...