제출 #154175

#제출 시각아이디문제언어결과실행 시간메모리
154175asifthegreatSplit the Attractions (IOI19_split)C++14
11 / 100
126 ms18808 KiB
#include <bits/stdc++.h> #include "split.h" using namespace std; const int N = 300000; vector<int>graph[N]; int mark[N]; int vis[N]; int baki; void dfs(int at){ if(baki == 0)return; // printf("%d here am I \n",at); mark[at] = 2; baki--; vis[at] = true; for(auto i: graph[at]){ if(vis[i] == true){ // cout <<i << " how can it be visited?\n"; continue; } dfs(i); } } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { vector<int> res; // vector<int> something; // something.push_back(a); // something.push_back(c); // something.push_back(b); // sort(something.first(),something.second()); // a = something[0],b=something[1],c=something[2]; for(int i = 0; i < p.size();i++){ // printf("The pair is ( %d %d )\n",p[i],q[i] ); graph[p[i]].push_back(q[i]); graph[q[i]].push_back(p[i]); } baki = b; // printf("%d\n",baki ); memset(vis,0,sizeof vis); dfs(0); for(int i = 0; i < n;i++){ if(!vis[i]){ vis[i] = true; mark[i]= 1; break; } } for(int i = 0; i < n;i++){ if(!vis[i]){ vis[i] = true; mark[i]= 3; // break; } } for(int i = 0; i < n;i++){ res.push_back(mark[i]); } return res; }

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

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