Submission #96384

# Submission time Handle Problem Language Result Execution time Memory
96384 2019-02-09T00:31:25 Z DiegoGarcia Sajam (COCI18_sajam) C++11
15 / 90
3895 ms 2484 KB
#include <bits/stdc++.h>
#define optimiza_io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define ft first
#define sd second
#define ll long long
#define ld long double
#define ull unsigned long long
#define INF 1E5
#define LINF 1E18
using namespace std;

int n,k,enc,ap,ans=0,ini,fin,md,maxi=0,probcol=0,probrow=0;
char mat[1003][1003];
bool mrk[1003][1003];
int row[1003],col[1003];

int main()
{
    scanf("%d %d",&n,&k);
    for( int i=0; i<n; i++ ){
        for( int j=0; j<n; j++ ){
            scanf(" %c",&mat[i][j]);
        }
    }
    for( int i=0; i<n; i++ ){
        for( int j=0; j<n; j++ ){
            for( int d = 1; d <= n-1; d++ )
            {
                if( i + d >= n || j + d >= n ){
                   // printf("%d %d : %d nope\n", i,j,d);
                    break;

                }
              //  printf("%d,%d : %d\n", i, j, d );
               // enc = ap = 0;
                if( mat[i][j+d] != mat[i][j] && mat[i+d][j] != mat[i][j] && mat[i+d][j+d] != mat[i][j] ){
                    if( !mrk[i][j] )
                    {
                        mrk[i][j] = true;
                        row[i]++;
                        col[j]++;
                    }

                }
                if( mat[i][j] != mat[i][j+d] && mat[i+d][j] != mat[i][j+d] && mat[i+d][j+d] != mat[i][j+d] ){
                    if( !mrk[i][j+d] )
                    {
                        mrk[i][j+d] = true;
                        row[i]++;
                        col[j+d]++;
                    }

                }
                if( mat[i][j] != mat[i+d][j] && mat[i][j+d] != mat[i+d][j] && mat[i+d][j+d] != mat[i+d][j] ){
                    if( !mrk[i+d][j] )
                    {
                        mrk[i+d][j] = true;
                        row[i+d]++;
                        col[j]++;
                    }
                }
                if( mat[i][j] != mat[i+d][j+d] && mat[i+d][j] != mat[i+d][j+d] && mat[i][j+d] != mat[i+d][j+d] ){
                    if( !mrk[i+d][j+d] )
                    {
                        mrk[i+d][j+d] = true;
                        row[i+d]++;
                        col[j+d]++;
                    }
                }
            }
        }
    }
    int maxicol = 0, maxirow = 0;
    for( int i=0; i<n; i++ ){
        maxicol = max( maxicol, col[i] );
        maxirow = max( maxirow, row[i] );
    }
   // printf("%d %d\n", maxicol, maxirow);
    if( min( maxicol, maxirow ) > k )
        printf("NE");
    else
        printf("DA");
    return 0;
}

Compilation message

sajam.cpp: In function 'int main()':
sajam.cpp:20:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d",&n,&k);
     ~~~~~^~~~~~~~~~~~~~~
sajam.cpp:23:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf(" %c",&mat[i][j]);
             ~~~~~^~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 245 ms 760 KB Output is correct
3 Correct 414 ms 888 KB Output is correct
4 Correct 2352 ms 1272 KB Output is correct
5 Correct 444 ms 888 KB Output is correct
6 Correct 107 ms 632 KB Output is correct
7 Correct 573 ms 1372 KB Output is correct
8 Correct 3776 ms 2168 KB Output is correct
9 Correct 58 ms 888 KB Output is correct
10 Correct 3895 ms 2208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 504 KB Output is correct
3 Correct 5 ms 504 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 3 ms 504 KB Output is correct
6 Incorrect 3 ms 376 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1307 ms 1916 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2071 ms 2172 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 861 ms 1656 KB Output is correct
2 Correct 884 ms 1656 KB Output is correct
3 Correct 3095 ms 2484 KB Output is correct
4 Correct 510 ms 1528 KB Output is correct
5 Correct 907 ms 1656 KB Output is correct
6 Incorrect 2845 ms 2364 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3245 ms 2336 KB Output is correct
2 Correct 2888 ms 2404 KB Output is correct
3 Correct 2585 ms 2196 KB Output is correct
4 Correct 1237 ms 1912 KB Output is correct
5 Correct 1288 ms 1912 KB Output is correct
6 Incorrect 1346 ms 1772 KB Output isn't correct
7 Halted 0 ms 0 KB -