# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
96991 | Danylo99 | Ispit (COCI19_ispit) | C++17 | 179 ms | 932 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define ll long long
#define LL long long
#define PB push_back
#define INF 2000000000
#define X first
#define Y second
using namespace std;
const LL mod = 998244353;
const LL MAX = 600005;
string s[505];
int diff[26];
int diff2[26];
int main()
{
//freopen("input.txt" , "r" , stdin);
ios_base::sync_with_stdio(0);
int n , k;
cin >> n >> k;
for(int i = 0; i < n; i++)
{
cin >> s[i];
for(auto &x : s[i])
x -= 'a';
}
for(int i = 0; i < n; i++)
{
for(int j = i + 1; j < n; j++)
{
memset(diff2 , 0 , sizeof diff2);
for(int k = 0; k < n; k++)
{
diff2[s[i][k]]-- , diff2[s[j][k]]++;
}
bool bad = false;
for(int k = 0; k < 26; k++)
bad |= diff2[k];
if(bad)
continue;
memset(diff , 0 , sizeof diff);
int cnt = 0;
for(int k = 0; k < n; k++)
{
if(s[i][k] != s[j][k])
{
cnt++;
diff[s[i][k]]++;
diff[s[j][k]]--;
}
}
for(int i = 0; i < 26; i++)
cnt += abs(diff[i]);
if(cnt / 2 > k)
continue;
cout << "DA";
return 0;
}
}
cout << "NE";
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |