답안 #204329

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
204329 2020-02-25T12:12:18 Z kshitij_sodani Split the Attractions (IOI19_split) C++17
0 / 100
126 ms 14196 KB
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#include <split.h>
#define mp make_pair
#define pb push_back
#define a first
#define b second
vector<int> adj[200001];
vector<int> stac;
int bb;
int vis[200001];
void dfs(int no){
	stac.pb(no);
	if(stac.size()==bb){
		return ;
	}
	for(int j=0;j<adj[no].size();j++){
		if(stac.size()==bb){
				return;
			}
		int nn=adj[no][j];
		if(vis[nn]==0){
			dfs(nn);
			
		}
	}
}
vector<int> find_split(int n,int a,int b,int c,vector<int> p,vector<int> q){
	int m=p.size();
	bb=b;
	memset(vis,0,sizeof(vis));
	for(int i=0;i<m;i++){
		adj[p[i]].pb(q[i]);
		adj[q[i]].pb(p[i]);
	}
	if(a==1){
		dfs(0);
		int st=1;
		vector<int> ans;
		for(int i=0;i<n;i++){
			ans.pb(0);
		}
		for(int j=0;j<b;j++){
			ans[stac[j]]=(int)2;

		}
		for(int i=0;i<n;i++){
			if(ans[i]==(int)2){
				continue;
			}
			ans[i]=st;
			st=3;
		}
		return ans;
	}
	vector<int> aa;
	return aa;
}
/*int main(){

	return 0;
}*/

Compilation message

split.cpp: In function 'void dfs(int)':
split.cpp:15:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  if(stac.size()==bb){
     ~~~~~~~~~~~^~~~
split.cpp:18:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int j=0;j<adj[no].size();j++){
              ~^~~~~~~~~~~~~~~
split.cpp:19:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if(stac.size()==bb){
      ~~~~~~~~~~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 5752 KB ok, correct split
2 Correct 9 ms 5880 KB ok, correct split
3 Correct 9 ms 5752 KB ok, correct split
4 Incorrect 8 ms 5880 KB WA in grader: Invalid length of the result.
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 5856 KB ok, correct split
2 Correct 9 ms 5752 KB ok, correct split
3 Correct 8 ms 5752 KB ok, correct split
4 Correct 126 ms 14068 KB ok, correct split
5 Incorrect 83 ms 14196 KB invalid split: #1=1, #2=2, #3=99996
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 9 ms 5880 KB WA in grader: Invalid length of the result.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 5880 KB WA in grader: Invalid length of the result.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 5752 KB ok, correct split
2 Correct 9 ms 5880 KB ok, correct split
3 Correct 9 ms 5752 KB ok, correct split
4 Incorrect 8 ms 5880 KB WA in grader: Invalid length of the result.
5 Halted 0 ms 0 KB -