# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
590719 | Jakub_Wozniak | Coins (LMIO19_monetos) | C++14 | 890 ms | 788 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |