제출 #1077695

#제출 시각아이디문제언어결과실행 시간메모리
1077695IgnutSplit the Attractions (IOI19_split)C++17
11 / 100
60 ms13480 KiB
// Ignut #include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 123; int n; int a, b, c; int colorA = 1, colorB = 2, colorC = 3; vector<int> g[MAXN]; int vert = -1; vector<int> res; int lim; void dfs(int v, int col) { if (lim == 0) return; res[v] = col; lim --; if (lim == 0) return; for (int to : g[v]) { if (res[to] != 3) continue; if (lim == 0) return; dfs(to, col); if (lim == 0) return; } if (lim == 0) return; } vector<int> find_split(int N, int A, int B, int C, vector<int> P, vector<int> Q) { int M = P.size(); for (int i = 0; i < M; i ++) { g[P[i]].push_back(Q[i]); g[Q[i]].push_back(P[i]); } res.assign(N, 3); vector<pair<int, int>> vec; for (int i = 0; i < N; i ++) vec.push_back({g[i].size(), i}); sort(vec.begin(), vec.end()); vert = vec[0].second; res[vert] = 1; int start = 0; if (start == vert) start ++; lim = B; dfs(start, 2); if (lim != 0) N /= 0; return res; }

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

split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:57:21: warning: division by zero [-Wdiv-by-zero]
   57 |     if (lim != 0) N /= 0;
      |                   ~~^~~~
#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...