제출 #1063099

#제출 시각아이디문제언어결과실행 시간메모리
1063099Ahmed57Split the Attractions (IOI19_split)C++17
0 / 100
1 ms2908 KiB
#include "bits/stdc++.h" using namespace std; vector<int> adj[100001]; vector<pair<int,int>> v; int vis[100001]; void precomp(int i,int dep){ vis[i] = 1; v.push_back({dep,i}); for(auto j:adj[i]){ if(!vis[j])continue; precomp(j,dep+1); } } vector<int> find_split(int n, int a, int b, int c, vector<int> p,vector<int> q){ for(int i = 0;i<p.size();i++){ adj[p[i]].push_back(q[i]); adj[q[i]].push_back(p[i]); } int inda = 1 , indb = 2 , indc = 3; if(a>b){swap(a,b);swap(inda,indb);} if(b>c){swap(b,c);swap(indb,indc);} if(a>b){swap(a,b);swap(inda,indb);} if(b>c){swap(b,c);swap(indb,indc);} precomp(0,0); sort(v.begin(),v.end()); reverse(v.begin(),v.end()); vector<int> ans(n,0); for(int i = 0;i<v.size();i++){ if(i<a)ans[v[i].second] = inda; else if(i<b+a)ans[v[i].second] = indb; else ans[v[i].second] = indc; } return ans; }

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

split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:16:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |     for(int i = 0;i<p.size();i++){
      |                   ~^~~~~~~~~
split.cpp:29:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |     for(int i = 0;i<v.size();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...
#Verdict Execution timeMemoryGrader output
Fetching results...