Submission #3076305


Source Code Expand

Copy
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<stdio.h>


using namespace std;
int main(void)
{
	int h, w;
	cin >> h >> w;
	vector<vector<char>> v(h, vector<char>(w));
	int i, j,num;
	vector<int> n(h, 0);
	vector<int> m(w, 0);
	for (i = 0; i < h; i++)
	{
		for (j =0 ; j < w; j++)
		{
			cin >> v[i][j];
		}
	}
	for (i = 0; i < h; i++)
	{
		 num = 0;
		for (j = 0; j < w; j++)
		{
			if (v[i][j] == '.')
			{
				num++;
			}
			if (num == w)
			{
				n[i] = 1;
			}
		}
	}

	for (j = 0; j < w; j++)
	{
	    num = 0;
		for (i = 0; i < h; i++)
		{
			if (v[i][j] == '.')
			{
				num++;
			}
			if (num == h)
			{
				m[j] = 1;
			}
		}
	}

	for (i = 0; i < h; i++)
	{
		for (j = 0; j < w; j++)
		{
			if (n[i] == 1)
			{
				i++;
			}
			if (m[j])
			{
				j++;
			}
			if (i == h || j == w)
			{
				continue;
			}
			cout << v[i][j];
		}
		cout << endl;
	}
	return 0;
}

Submission Info

Submission Time
Task B - Grid Compression
User kanta
Language C++ (GCC 5.4.1)
Score 0
Code Size 981 Byte
Status

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:13:20: error: ‘>>’ should be ‘> >’ within a nested template argument list
  vector<vector<char>> v(h, vector<char>(w));
                    ^