답안 #588065

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
588065 2022-07-02T16:57:25 Z jmyszka2007 Coins (LMIO19_monetos) C++17
0 / 100
24 ms 932 KB
#include <bits/stdc++.h>
using namespace std;
int tab[310][310];
char res[310][310];
int main() {
	int t, n, a, b;
	cin >> t >> n >> a >> b;
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j <= n; j++) {
			cin >> tab[i][j];
		}
	}
	int ans = 0;
	for(int i = 1; i <= n / 2; i++) {
		for(int j = 1; j <= n; j++) {
			if(tab[i][j]) {
				ans++;
			}
		}
	}
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j <= n; j++) {
			if(i <= n / 2) {
				res[i][j] = '0';
			}
			else {
				res[i][j] = '1';
			}
		}
	}
	int tmp = ans;
	int mn = ans;
	int y = n / 2;
	int x = n;
	for(int i = n / 2 + 1; i <= n; i++) {
		for(int j = 1; j <= n / 2; j++) {
			if(!tab[i][j] && tab[y][x]) {
				ans--;
				mn = min(mn, ans);
			}
			if(x == n / 2) {
				x = n;
				y--;
			}
			else {
				x--;
			}
		}
	}
	y = n / 2;
	x = n;
	for(int i = n / 2 + 1; i <= n; i++) {
		for(int j = 1; j <= n / 2; j++) {
			if(tmp == mn) {
				for(int k = 1; k <= n; k++) {
					for(int l = 1; l <= n; l++) {
						cout << res[k][l] << " ";
					}
					cout << '\n';
				}
				return 0;
			}
			swap(res[i][j], res[y][x]);
			if(!tab[i][j] && tab[y][x]) {
				tmp--;
			}
			if(x == n / 2) {
				x = n;
				y--;
			}
			else {
				x--;
			}
		}
	}
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB improper placement
2 Incorrect 1 ms 340 KB improper placement
3 Incorrect 18 ms 852 KB improper placement
4 Incorrect 15 ms 676 KB Unexpected end of file - int32 expected
5 Incorrect 19 ms 884 KB improper placement
6 Incorrect 24 ms 932 KB improper placement
7 Incorrect 15 ms 708 KB Unexpected end of file - int32 expected
8 Incorrect 19 ms 852 KB improper placement
9 Incorrect 17 ms 832 KB improper placement
10 Incorrect 20 ms 912 KB improper placement