답안 #1049390

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1049390 2024-08-08T17:51:45 Z vjudge1 Make them Meet (EGOI24_makethemmeet) C++17
57 / 100
3 ms 600 KB
#include <bits/stdc++.h>

using namespace std;

#define ar array
#define int long long
#define ld long double

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")

const int N = 200;
const int X = N * N;
const int K = 500;
const int MOD = 1e9 + 7;

const int LOG = 21;
const int INF = 1e17;

vector<int> g[N];

int col[2][N];
int c[2];


bitset<N> vis;

void dfs2(int x,int p, bool t, bool b){
	vis[x] = 1;
	if(b){
		if(t){
			col[0][x] = ++c[0];
			col[1][x] = col[1][p];
		}else{
			col[0][x] = col[0][p];
			col[1][x] = ++c[1];
		}
	}
	
	
	
	for(auto u: g[x]){
		if(u ==p)continue;
		if(!vis[u])dfs2(u, x, t ^ 1, 1);
	}
}

void dfs1(int x){
	vis[x] = 1;
	for(auto u: g[x]){
		if(!vis[u])dfs1(u);
	}
}

signed main(){ios::sync_with_stdio(false);cin.tie(0);	
	int n, m;
	cin>>n>>m;
	
	for(int i = 0;i < m;i++){
		int u, v;
		cin>>u>>v;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	
	for(int i = 0;i < n;i++){
		vis &= 0;
		vis[i] = 1;
		dfs1(g[i][0]);
		if(vis.count() == n){
			vis &= 0;
			col[0][i] = col[0][g[i][i]] = col[1][i] = col[1][g[i][i]] = 0;
			vis[i] = 1;
			dfs2(g[i][0], i, 1, 0);
			break;
		}
	}
	cout<<4 * n<<endl;
	for(int j = 0;j < 4 * n;j++){
		for(int i = 0;i < n;i++)cout<<col[j % 2][i]<<" ";
		cout<<endl;
	}
	
	
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:70:18: warning: comparison of integer expressions of different signedness: 'std::size_t' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   70 |   if(vis.count() == n){
      |      ~~~~~~~~~~~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 2 ms 436 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB If people start at 0 and 1, then they can avoid each other
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 2 ms 600 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 2 ms 436 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 2 ms 600 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 2 ms 348 KB Output is correct
17 Correct 2 ms 348 KB Output is correct
18 Correct 0 ms 600 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 2 ms 348 KB Output is correct
22 Correct 2 ms 348 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 384 KB Output is correct
27 Correct 2 ms 348 KB Output is correct
28 Correct 2 ms 492 KB Output is correct
29 Correct 2 ms 348 KB Output is correct
30 Correct 2 ms 488 KB Output is correct
31 Correct 2 ms 344 KB Output is correct
32 Correct 2 ms 348 KB Output is correct
33 Correct 2 ms 348 KB Output is correct
34 Correct 2 ms 576 KB Output is correct
35 Correct 2 ms 348 KB Output is correct
36 Correct 2 ms 348 KB Output is correct
37 Correct 2 ms 348 KB Output is correct
38 Correct 2 ms 348 KB Output is correct
39 Correct 3 ms 348 KB Output is correct
40 Correct 2 ms 344 KB Output is correct
41 Correct 2 ms 348 KB Output is correct
42 Correct 2 ms 436 KB Output is correct
43 Correct 2 ms 348 KB Output is correct
44 Correct 2 ms 348 KB Output is correct
45 Correct 2 ms 348 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 0 ms 348 KB Output is correct
48 Correct 0 ms 348 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 0 ms 348 KB Output is correct
51 Correct 0 ms 348 KB Output is correct
52 Correct 0 ms 348 KB Output is correct
53 Correct 0 ms 348 KB Output is correct
54 Correct 0 ms 348 KB Output is correct
55 Correct 0 ms 348 KB Output is correct
56 Correct 0 ms 344 KB Output is correct
57 Correct 0 ms 348 KB Output is correct
58 Correct 0 ms 348 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 0 ms 348 KB Output is correct
61 Correct 0 ms 348 KB Output is correct
62 Correct 0 ms 348 KB Output is correct
63 Correct 1 ms 348 KB Output is correct
64 Correct 0 ms 348 KB Output is correct
65 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 2 ms 436 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 0 ms 348 KB If people start at 0 and 1, then they can avoid each other
8 Halted 0 ms 0 KB -