Submission #96383

#TimeUsernameProblemLanguageResultExecution timeMemory
96383DiegoGarciaSajam (COCI18_sajam)C++11
15 / 90
3968 ms3348 KiB
#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 ) break; // 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] ); } if( min( maxicol, maxirow ) > k ) printf("NE"); else printf("DA"); return 0; }

Compilation message (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...