Submission #1049387

# Submission time Handle Problem Language Result Execution time Memory
1049387 2024-08-08T17:50:22 Z vjudge1 Make them Meet (EGOI24_makethemmeet) C++17
21 / 100
4 ms 572 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 &= 1;
		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){
      |      ~~~~~~~~~~~~^~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 2 ms 496 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 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 -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 460 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 348 KB Output is correct
6 Correct 2 ms 572 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 2 ms 496 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 460 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 348 KB Output is correct
11 Correct 2 ms 572 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 344 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 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 2 ms 348 KB Output is correct
22 Correct 3 ms 344 KB Output is correct
23 Correct 1 ms 348 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 344 KB Output is correct
27 Correct 2 ms 348 KB Output is correct
28 Correct 4 ms 348 KB Output is correct
29 Correct 2 ms 348 KB Output is correct
30 Correct 2 ms 348 KB Output is correct
31 Incorrect 2 ms 348 KB If people start at 0 and 1, then they can avoid each other
32 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 2 ms 496 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
6 Correct 1 ms 344 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 -