제출 #551495

#제출 시각아이디문제언어결과실행 시간메모리
551495PiejanVDCSplit the Attractions (IOI19_split)C++17
0 / 100
1 ms212 KiB
#include "split.h" #include<bits/stdc++.h> using namespace std; vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { vector<int>adj[n]; const int m = (int)p.size(); for(int i = 0 ; i < m ; i++) { adj[p[i]].push_back(q[i]); adj[q[i]].push_back(p[i]); } vector<int>col(n,0); int start = 0; for(int i = 0 ; i < n ; i++) if((int)adj[i].size() == 1) start = i; stack<int>s; s.push(start); int sz = 1; col[start] = 2; vector<bool>vis(n,0); vis[start] = 1; while(sz < b) { int node = s.top(); s.pop(); col[node] = 2; sz++; for(auto z : adj[node]) if(!vis[z]) { s.push(z); vis[z] = 1; } } for(int i = 0 ; i < n ; i++) { if(!vis[i]) { while(!s.empty()) s.pop(); s.push(i); sz = 1; vis[i] = 1; col[i] = 1; while(sz < a) { int node = s.top(); s.pop(); sz++; col[node] = 1; for(auto z : adj[node]) if(!vis[z]) { s.push(z); vis[z] = 1; } } break; } } for(int i = 0 ; i < n ; i++) if(!col[i]) col[i] = 3; return col; }

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

split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:58:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   58 |     for(int i = 0 ; i < n ; i++)
      |     ^~~
split.cpp:61:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   61 |         return col;
      |         ^~~~~~
#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...