Submission #198856

#TimeUsernameProblemLanguageResultExecution timeMemory
198856ZwariowanyMarcinIspit (COCI19_ispit)C++14
90 / 90
37 ms764 KiB
#include <bits/stdc++.h> #define fi first #define se second #define mp make_pair #define ss(x) (int) x.size() #define pb push_back #define LL long long #define ld long double #define cat(x) cerr << #x << " = " << x << endl #define FOR(i, j, n) for(int i = j; i <= n; ++i) #define boost cin.tie(0), ios_base::sync_with_stdio(0); using namespace std; const int nax = 510; int n, k; char s[nax][nax]; void tak() { printf ("DA"); exit(0); } void nie() { printf ("NE"); exit(0); } int t[2][26]; int main() { scanf ("%d%d", &n, &k); for (int i = 1; i <= n; ++i) scanf ("%s", s[i] + 1); for (int i = 1; i <= n; ++i) for (int j = i + 1; j <= n; ++j) { int l = 1; int r = n; while (l <= n && s[i][l] == s[j][l]) l++; while (1 <= r && s[i][r] == s[j][r]) r--; if (l == n) tak(); if (r - l + 1 > k) continue; for (int j = 0; j < 2; ++j) for (int c = 0; c < 26; ++c) t[j][c] = 0; for (int k = l; k <= r; ++k) { t[0][s[i][k] - 'a']++; t[1][s[j][k] - 'a']++; } bool ok = 1; for (int c = 0; c < 26; ++c) if (t[0][c] != t[1][c]) ok = 0; if (ok) tak(); } nie(); return 0; }

Compilation message (stderr)

ispit.cpp: In function 'int main()':
ispit.cpp:34: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:36:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf ("%s", s[i] + 1);
   ~~~~~~^~~~~~~~~~~~~~~~
#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...