Submission #590719

# Submission time Handle Problem Language Result Execution time Memory
590719 2022-07-06T09:19:44 Z Jakub_Wozniak Coins (LMIO19_monetos) C++14
1.13228 / 100
890 ms 788 KB
#include <bits/stdc++.h>
using namespace std;
int T,K1,K2, N;
int plansza[309][309];
struct pozycja
{
	int x;
	int y;
};
 
pozycja najblizej_1()
{
	pozycja poz;
	for(int i=0;i<N;i++)
	{
		for(int j=0;j<N;j++)
		{
			if(plansza[i][j]==1)
			{
				poz.x=j;
				poz.y=i;
				return poz;
			}
		}
	}
	return poz;
}
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]=1;
					plansza[najblizej_1().y][najblizej_1().x]=0;
				}
			}
			s=0;
		}
	}
    

	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:40:13: warning: unused variable 'poz' [-Wunused-variable]
   40 |     pozycja poz;
      |             ^~~
monetos.cpp:41:13: warning: unused variable 'wynik' [-Wunused-variable]
   41 |     int s=0,wynik=0;
      |             ^~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB improper placement
2 Incorrect 2 ms 340 KB K = 623
3 Incorrect 786 ms 768 KB improper placement
4 Incorrect 890 ms 772 KB improper placement
5 Incorrect 863 ms 768 KB K = 21462
6 Partially correct 793 ms 776 KB K = 22330
7 Partially correct 794 ms 772 KB K = 22537
8 Incorrect 809 ms 788 KB K = 25631
9 Incorrect 727 ms 772 KB improper placement
10 Incorrect 842 ms 768 KB improper placement