Submission #147636

#TimeUsernameProblemLanguageResultExecution timeMemory
147636nandonathanielSplit the Attractions (IOI19_split)C++14
11 / 100
114 ms10872 KiB
#include "split.h" #include <bits/stdc++.h> using namespace std; const int MAXN=100005; int cntB,warna[MAXN]; vector<int> adj[MAXN]; bool visited[MAXN]; int brp=0; bool keluar=false; void dfs(int now){ //cout << "now " << now << endl; if(brp==cntB)return; visited[now]=true; warna[now]=2; brp++; for(int i=0;i<adj[now].size();i++){ int nxt=adj[now][i]; if(!visited[nxt]){ dfs(nxt); } } } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { memset(visited,0,sizeof(visited)); memset(warna,0,sizeof(warna)); cntB=b; vector<int> res; for(int i=0;i<p.size();i++){ adj[p[i]].push_back(q[i]); adj[q[i]].push_back(p[i]); } dfs(0); bool sudah=false; for(int i=0;i<n;i++){ if(warna[i]==0){ if(!sudah){ warna[i]=1; sudah=true; } else warna[i]=3; } res.push_back(warna[i]); } return res; }

Compilation message (stderr)

split.cpp: In function 'void dfs(int)':
split.cpp:16:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<adj[now].size();i++){
              ~^~~~~~~~~~~~~~~~
split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:29:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  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...