Submission #3076526


Source Code Expand

#include <bits/stdc++.h>

using namespace std;

int n, m, row[105], col[105], del_row[105], del_col[105];
char a[105][105];

int main() {
	cin >> n >> m;
	char c;
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++) {
			cin >> c;
			int d = c == '#' ? 1 : 0;
			a[i][j] = c;
			if(!d) row[i]++, col[j]++;
		}
	for(int i = 1; i <= n; i++)
		if(row[i] == m) del_row[i] = 1;
	for(int j = 1; j <= m; j++)
		if(col[j] == n) del_col[j] = 1;
	for(int i = 1; i <= n; i++) {
		if(del_row[i]) continue;
		for(int j = 1; j <= m; j++)
			if(!del_col[j]) cout << a[i][j];
		cout << endl;
	}
	return 0;
}

Submission Info

Submission Time
Task B - Grid Compression
User dummyummy
Language C++14 (GCC 5.4.1)
Score 200
Code Size 625 Byte
Status AC
Exec Time 2 ms
Memory 256 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 4
AC × 12
Set Name Test Cases
Sample 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt
All 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt
Case Name Status Exec Time Memory
0_00.txt AC 1 ms 256 KiB
0_01.txt AC 1 ms 256 KiB
0_02.txt AC 1 ms 256 KiB
0_03.txt AC 1 ms 256 KiB
1_00.txt AC 1 ms 256 KiB
1_01.txt AC 2 ms 256 KiB
1_02.txt AC 2 ms 256 KiB
1_03.txt AC 2 ms 256 KiB
1_04.txt AC 2 ms 256 KiB
1_05.txt AC 2 ms 256 KiB
1_06.txt AC 2 ms 256 KiB
1_07.txt AC 2 ms 256 KiB