제출 #619322

#제출 시각아이디문제언어결과실행 시간메모리
619322Icebear16Traffic (IOI10_traffic)C++14
0 / 100
3 ms3076 KiB
#include "traffic.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; #define INF 1e18//change to const int INF=1e18 if causing problem const ll MOD=998244353; const ll alt=1e10; const ll inf=1e9+7;//Precalc is not a bad idea //#define int ll #define pb push_back #define pf push_front #define mp make_pair #define fi first #define se second #define mod(a) (a+inf)%inf #define all(a) a.begin(),a.end() #define rall(a) a.rbegin(),a.rend() #define sz(a) a.size() vector<int> adj[100000]; priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > q; vector<int> vis(100000,0); vector<bool> visd(100000,false); int LocateCentre(int N, int pp[], int s[], int d[]){ for(int i=0;i<N;i++){ adj[s[i]].pb(d[i]); adj[d[i]].pb(s[i]); } for(int i=0;i<N;i++){ if(adj[i].size()==1){ q.push(mp(pp[i],i)); visd[i]=true; } } while(sz(q)>1){ int a=q.top().fi,b=q.top().se; q.pop(); int y=0; for(int i=0;i<sz(adj[b]);i++){ if(!visd[adj[b][i]]){ y=i; break; } } pp[adj[b][y]]+=a; vis[adj[b][y]]+=1; if(sz(adj[adj[b][y]])-vis[adj[b][y]]==1){ q.push(mp(pp[adj[b][y]],adj[b][y])); visd[adj[b][y]]=true; } } return q.top().se; } //Icebear16

컴파일 시 표준 에러 (stderr) 메시지

traffic.cpp: In function 'int LocateCentre(int, int*, int*, int*)':
traffic.cpp:40:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |   for(int i=0;i<sz(adj[b]);i++){
      |                ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...