답안 #590669

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
590669 2022-07-06T08:30:45 Z Jakub_Wozniak Coins (LMIO19_monetos) C++14
5.3373 / 100
23 ms 832 KB
#include <bits/stdc++.h>
using namespace std;
int T,K1,K2, N;
int plansza[309][309];
struct pozycja
{
	int x;
	int y;
};

 
int main()
{
	
	cin >> T >> N >> K1 >> K2;
	
	for(int i=0;i<N;i++)
	{
		for(int j=0;j<N;j++)
		{
			cin >> plansza[i][j];
		}
	}
    pozycja poz;
    int s=0,wynik=0;
    
    for(int i=N-1;i>=0;i--)
	{
		for(int j=N-1;j>=0;j--)
		{
			if(plansza[i][j]==0)
			{
				for(int l=j-1;l>=0;l--)
				{
					if(plansza[i][l]==1)
					{
						s=1;
						break;
					}
				}
				for(int l=i-1;l>=0;l--)
				{
					if(plansza[l][j]==1)
					{
						s=1;
						break;
					}
				}
				
				if(s>=1)
				{
					plansza[i][j]=s;
					wynik++;
				}
			}
			s=0;
		}
	}
    
    for(int i=0;i<N;i++)
	{
		for(int j=0;j<N;j++)
		{
			if(plansza[i][j]==1 && wynik>0)
			{
				plansza[i][j]=0;
				wynik--;
			}
		}
	}
	
	for(int i=0;i<N;i++)
	{
		for(int j=0;j<N;j++)
		{
			cout << plansza[i][j] << " ";
		}
		cout << "\n";
	}
	return 0;
}

Compilation message

monetos.cpp: In function 'int main()':
monetos.cpp:24:13: warning: unused variable 'poz' [-Wunused-variable]
   24 |     pozycja poz;
      |             ^~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB K = 24
2 Incorrect 1 ms 340 KB K = 623
3 Partially correct 20 ms 792 KB K = 20313
4 Partially correct 20 ms 832 KB K = 23205
5 Incorrect 21 ms 768 KB K = 21462
6 Partially correct 20 ms 776 KB K = 22330
7 Partially correct 19 ms 724 KB K = 22537
8 Incorrect 23 ms 792 KB K = 25631
9 Incorrect 21 ms 728 KB K = 22541
10 Partially correct 20 ms 764 KB K = 22367