Submission #218950

#TimeUsernameProblemLanguageResultExecution timeMemory
218950quocnguyen1012Ispit (COCI19_ispit)C++14
90 / 90
36 ms896 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; const int maxn = 500 + 10; string s[maxn]; int a[30], b[30]; int main(){ ios_base::sync_with_stdio(false); int n, m; cin >> n >> m; for (int i = 0; i < n; i++) cin >> s[i]; for (int i = 0; i < n; i++){ for (int j = i + 1; j < n; j++){ int pre = 0, suf = n - 1; for (int k = 0; k < n and s[i][k] == s[j][k]; k++) pre ++; for (int k = n - 1; k >= 0 and s[i][k] == s[j][k]; k--) suf --; if (suf - pre + 1 > m) continue; memset(a, 0, sizeof a), memset(b, 0, sizeof b); for (int k = pre; k <= suf; k++){ a[int(s[i][k] - 'a')] ++; b[int(s[j][k] - 'a')] ++; } bool found = 0; for (int k = 0; k < 26; k++) if (a[k] != b[k]) found = 1; if (!found) return cout << "DA\n", 0; } } cout << "NE\n"; }
#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...