QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#342452#4084. 카드 뒤집기 게임Unknown1508Compile Error//C++201.3kb2024-03-01 11:26:582024-03-01 11:26:58

Judging History

你现在查看的是最新测评结果

  • [2024-03-01 11:26:58]
  • 评测
  • [2024-03-01 11:26:58]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

void main_program();

signed main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	main_program();
}

struct DSU {
	vector<int> parent;

	DSU() {}
	DSU(int N): parent(N, -1) {}

	int get(int x){
		return (parent[x] < 0) ? x : (parent[x] = get(parent[x]));
	}

	bool merge(int a, int b){
		a = get(a); b = get(b);
		if (a == b) return false;

		if (parent[a] > parent[b]) swap(a, b);
		parent[a] += parent[b];
		parent[b] = a;
		return true;
	}
};

bool check(int n, const vector<string> &vec){
	int R = vec.size(), C = vec[0].size();

	DSU dsu((R + C) * 2);

	for (int i = 0; i < R; i++){
		for (int j = 0; j < C; j++){
			if (vec[i][j] == 'X'){
				dsu.merge(R, C + n);
				dsu.merge(R + 1, C + n + 1);
			}
			else{
				dsu.merge(R, C + n + 1);
				dsu.merge(R + 1, C + n);
			}
		}
	}

	for (int i = 0; i < (R + C) * 2; i += 2){
		if (dsu.get(i) == dsu.get(i+1)) return false;
	}
	return true;
}

bool reversal(int n, int m, vector<string> v){
	bool valid = true;
	for (int a = 0; a < m; a++){
		for (int b = 0; b < m; b++){
			vector<string> vec;
			for (int row = a; row < n; row += m){
				vec.emplace_back();
				for (int col = b; col < n; col += m){
					vec.back().push_back(v[row][col]);
				}
			}

			valid &= check(n, vec);
		}
	}
	return valid;
}

Details

/usr/bin/ld: /tmp/ccpPeKNK.o: in function `main':
answer.code:(.text.startup+0x0): multiple definition of `main'; /tmp/ccmXdUwK.o:implementer.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccpPeKNK.o: in function `main':
answer.code:(.text.startup+0x1b): undefined reference to `main_program()'
collect2: error: ld returned 1 exit status