제출 #299142

#제출 시각아이디문제언어결과실행 시간메모리
299142TMJNSplit the Attractions (IOI19_split)C++17
11 / 100
124 ms12664 KiB
#include "split.h" #include <bits/stdc++.h> using namespace std; vector<int>e[100000]; vector<int>find_split(int n,int a,int b,int c,vector<int>p,vector<int>q){ vector<int>res(n,0); pair<int,int>P[3]; P[0]={a,1}; P[1]={b,2}; P[2]={c,3}; sort(P,P+3); for(int i=0;i<p.size();i++){ e[p[i]].push_back(q[i]); e[q[i]].push_back(p[i]); } if(P[0].first==1){ queue<int>que; que.push(0); while(P[1].first){ int x=que.front(); que.pop(); if(res[x])continue; res[x]=P[1].second; P[1].first--; for(int i:e[x]){ que.push(i); } } for(int i=0;i<n;i++){ if(!res[i]){ res[i]=P[0].second; break; } } for(int i=0;i<n;i++){ if(!res[i]){ res[i]=P[2].second; } } } return res; }

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

split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:14:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |  for(int i=0;i<p.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...