Submission #147509

#TimeUsernameProblemLanguageResultExecution timeMemory
147509ipaljakIspit (COCI19_ispit)C++14
45 / 90
259 ms892 KiB
#include <bits/stdc++.h> using namespace std; #define TRACE(x) cerr << #x << " " << x << endl #define FOR(i, a, b) for (int i = (a); i < int(b); ++i) #define REP(i, n) FOR(i, 0, n) #define _ << " " << typedef long long llint; const int MOD = 1e9 + 7; const int MAXN = 505; bool ok[MAXN]; int n, k; char s[MAXN][MAXN]; int main(void) { scanf("%d%d", &n, &k); for (int i = 0; i < n; ++i) scanf("%s", s[i]); for (int j = 0; j < n; ++j) { int cnt[26]; memset(cnt, 0, sizeof cnt); for (int i = 0; i < n; ++i) { ++cnt[s[i][j] - 'a']; if (cnt[s[i][j] - 'a'] > 1) ok[j] = true; } } for (int i = 0; i < n; ++i) { for (int j = i + 1; j < n; ++j) { bool check = true; int lo = n - 1, hi = 0; for (int k = 0; k < n; ++k) { if (s[i][k] == s[j][k]) continue; if (!ok[k]) check = false; lo = min(lo, k); hi = max(hi, k); } if (check && hi - lo + 1 <= k) { printf("DA\n"); return 0; } } } printf("NE\n"); return 0; }

Compilation message (stderr)

ispit.cpp: In function 'int main()':
ispit.cpp:21:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d", &n, &k);
   ~~~~~^~~~~~~~~~~~~~~~
ispit.cpp:22:36: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   for (int i = 0; i < n; ++i) scanf("%s", s[i]);
                               ~~~~~^~~~~~~~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...