Submission #232715

#TimeUsernameProblemLanguageResultExecution timeMemory
232715UserIsUndefinedSplit the Attractions (IOI19_split)C++14
7 / 100
244 ms22868 KiB
#include <bits/stdc++.h> #include "split.h" using namespace std; vector<int> adj[100005]; int ok; map<int,int> visited; map<int,int> good; int sz; int now; void dfs(int v){ visited[v] = true; sz--; good[v] = now; // cout << "nwo and size : " << now << " " << sz << endl; if (sz <= 0){ if (sz < 0){visited[v] = false; good[v] = 0;} return ; } for (int i : adj[v]){ if (visited[i] == false){ dfs(i); } } } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { vector<int> res(n, 0); for (int i = 0 ; i < p.size() ; i++){ int x = p[i]; int y = q[i]; adj[x].push_back(y); adj[y].push_back(x); } sz = a; now = 1; dfs(0); sz = b; now = 2; for (int i = 0 ; i < n ; i++){ if (visited[i] == 0)dfs(i); } for (int i = 0 ; i < n ; i++){ res[i] = (good[i] == 0 ? 3 : good[i]); } // for (int i = 0 ; i < res.size() ; i++){ // cout << res[i] << endl; // } return res; }

Compilation message (stderr)

split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:40:24: 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...