Submission #443123

# Submission time Handle Problem Language Result Execution time Memory
443123 2021-07-09T18:34:25 Z The_Panonian_Sailor Paint (COI20_paint) C++14
0 / 100
368 ms 524292 KB
#include <iostream>

int a[20][20];

using namespace std;

void obojiSve(int a1, int b1, int c, int m, int n)
{
    int poc=a[a1][b1];
    a[a1][b1]=c;
    if(a[a1+1][b1]==poc && a1<n-1)
    {
        obojiSve(a1+1,b1,c, m, n);
    }
    if(a[a1-1][b1]==poc && a1>0)
    {
        obojiSve(a1-1,b1,c,m,n);
    }
    if(a[a1][b1+1]==poc && b1<m-1)
    {
        obojiSve(a1,b1+1,c,m,n);
    }
    if(a[a1][b1-1]==poc && b1>0)
    {
        obojiSve(a1,b1-1,c,m,n);
    }
}
int main()
{
    int n,m;
    cin>>n>>m;
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<m; j++)
        {
            cin>>a[i][j];
        }
    }

    int q,a1,b1,c;
    cin>>q;
    for(int k=0; k<q; k++)
    {
        cin>>a1>>b1>>c;
        a1--;b1--;
        obojiSve(a1,b1,c,m,n);
    }
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<m; j++)
        {
            cout<<a[i][j]<<' ';
        }
        cout<<endl;
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Runtime error 368 ms 524292 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 460 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 460 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 460 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -