제출 #521021

#제출 시각아이디문제언어결과실행 시간메모리
521021zsomborSplit the Attractions (IOI19_split)C++17
11 / 100
96 ms10392 KiB
#include "split.h" #include <bits/stdc++.h> using namespace std; int bcount; vector <vector <int>> g(1e5); vector <bool> bo(1e5,true); vector<int> res; void dfs(int x){ if (bcount==-1 || !bo[x]) return; if (bcount==0){ res[x]=1; bcount--; return; } res[x]=2; bcount--; bo[x]=false; for (int i : g[x]) dfs(i); } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { res.resize(n,3); int cur=0; for (int i=0;i<p.size();i++){ g[p[i]].push_back(q[i]); g[q[i]].push_back(p[i]); } if (a == 1) { bcount=b; dfs(0); } else { for (int i=0;i<n;i++) if (g[i].size()==1) cur = i; for (int i = 0;i<a;i++){ res[cur]=1; bo[cur]=false; if (bo[g[cur][0]]){ cur=g[cur][0]; }else{ cur=g[i][1]; } } for (int i = 0;i<b;i++){ res[cur]=2; bo[cur]=false; if (bo[g[cur][0]]){ cur=g[cur][0]; }else{ cur=g[cur][1]; } } } return res; }

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

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