답안 #96385

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
96385 2019-02-09T00:49:07 Z DiegoGarcia Sajam (COCI18_sajam) C++11
15 / 90
3992 ms 2428 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;

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

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

                }
              //  printf("%lld,%lld : %lld\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]++;
                    }
                }
            }
        }
    }
    ll maxicol = 0, maxirow = 0;
    for( ll i=0; i<n; i++ ){
        maxicol = max( maxicol, col[i] );
        maxirow = max( maxirow, row[i] );
    }
   // printf("%lld %lld\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("%lld %lld",&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]);
             ~~~~~^~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 238 ms 860 KB Output is correct
3 Correct 420 ms 892 KB Output is correct
4 Correct 2420 ms 1256 KB Output is correct
5 Correct 441 ms 760 KB Output is correct
6 Correct 105 ms 760 KB Output is correct
7 Correct 569 ms 1272 KB Output is correct
8 Correct 3869 ms 2296 KB Output is correct
9 Correct 55 ms 760 KB Output is correct
10 Correct 3992 ms 2228 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 504 KB Output is correct
3 Correct 4 ms 504 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 4 ms 504 KB Output is correct
6 Incorrect 3 ms 376 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1380 ms 1912 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2145 ms 2176 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 902 ms 1784 KB Output is correct
2 Correct 903 ms 1656 KB Output is correct
3 Correct 3204 ms 2424 KB Output is correct
4 Correct 521 ms 1488 KB Output is correct
5 Correct 945 ms 1656 KB Output is correct
6 Incorrect 2953 ms 2296 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3265 ms 2348 KB Output is correct
2 Correct 3016 ms 2428 KB Output is correct
3 Correct 2673 ms 2208 KB Output is correct
4 Correct 1279 ms 1920 KB Output is correct
5 Correct 1266 ms 1912 KB Output is correct
6 Incorrect 1402 ms 1912 KB Output isn't correct
7 Halted 0 ms 0 KB -