제출 #298329

#제출 시각아이디문제언어결과실행 시간메모리
298329RayaabualjamalSplit the Attractions (IOI19_split)C++14
11 / 100
155 ms10912 KiB
#include "split.h" #include <cassert> #include <iostream> #include <set> #include <iterator> #include <cmath> #include <algorithm> #include <vector> #include <map> #include <cstdio> #define rep(i,a,b) for(int i = a; i<b; i++) #define per(i,a,b) for(int i = a; i>=b; i--) #define pb push_back #define se second using namespace std; vector <int> ans; vector < vector <int> > ve; void bfs(int h, int d){ set<int> s; s.insert(0); ans[0] = d; h--; while(!s.empty()&&h){ int best = *s.begin(); s.erase(s.begin()); for(int k:ve[best]){ if(h&&ans[k]!=d){ ans[k]=d; h--; s.insert(k); } } } rep(i,0,ans.size()){ if(ans[i]!=d){ ans[i]=1; break; } } return; } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { if(b<c)ans.assign(n,3); if(b>=c)ans.assign(n,2); ve.resize(n+1); rep(i,0,p.size()){ ve[p[i]].pb(q[i]); ve[q[i]].pb(p[i]); } bfs(min(b, c), (b<c?2:3)); return ans; }

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

split.cpp: In function 'void bfs(int, int)':
split.cpp:12:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 | #define rep(i,a,b) for(int i = a; i<b; i++)
......
   35 |  rep(i,0,ans.size()){
      |      ~~~~~~~~~~~~~~                 
split.cpp:35:2: note: in expansion of macro 'rep'
   35 |  rep(i,0,ans.size()){
      |  ^~~
split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:12:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 | #define rep(i,a,b) for(int i = a; i<b; i++)
......
   47 |  rep(i,0,p.size()){
      |      ~~~~~~~~~~~~                   
split.cpp:47:2: note: in expansion of macro 'rep'
   47 |  rep(i,0,p.size()){
      |  ^~~
#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...