Submission #232485

# Submission time Handle Problem Language Result Execution time Memory
232485 2020-05-17T07:30:02 Z VEGAnn Ispit (COCI19_ispit) C++14
90 / 90
36 ms 2432 KB
#include <bits/stdc++.h>
#define ft first
#define sd second
#define sz(x) ((int)x.size())
using namespace std;
typedef long long ll;
const int N = 50100;
string s[N];
int kol[26], cnt[26], n, k;

void YEE_BOOOOOOOOOY(){
    cout << "DA";
    exit(0);
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);

#ifdef _LOCAL
    freopen("in.txt","r",stdin);
#endif // _LOCAL

    cin >> n >> k;

    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 pf = 0;

        while (pf < n && s[i][pf] == s[j][pf])
            pf++;

        if (pf == n)
            YEE_BOOOOOOOOOY();

        int sf = n - 1;

        while (sf >= 0 && s[i][sf] == s[j][sf])
            sf--;

        if (n - (pf + (n - 1 - sf)) > k)
            continue;

        fill(kol, kol + 26, 0);
        fill(cnt, cnt + 26, 0);

        for (int z = pf; z <= sf; z++){
            kol[s[i][z] - 'a']++;
            cnt[s[j][z] - 'a']++;
        }

        bool bad = 0;

        for (int z = 0; z < 26 && !bad; z++)
            if (kol[z] != cnt[z])
                bad = 1;

        if (!bad)
            YEE_BOOOOOOOOOY();
    }

    cout << "NE";

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 1920 KB Output is correct
2 Correct 5 ms 1920 KB Output is correct
3 Correct 5 ms 1920 KB Output is correct
4 Correct 5 ms 1920 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 1920 KB Output is correct
2 Correct 5 ms 1920 KB Output is correct
3 Correct 5 ms 1920 KB Output is correct
4 Correct 5 ms 1920 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 1920 KB Output is correct
2 Correct 5 ms 1920 KB Output is correct
3 Correct 5 ms 2048 KB Output is correct
4 Correct 6 ms 1920 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1920 KB Output is correct
2 Correct 6 ms 2048 KB Output is correct
3 Correct 6 ms 2048 KB Output is correct
4 Correct 6 ms 2048 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 36 ms 1920 KB Output is correct
2 Correct 6 ms 1920 KB Output is correct
3 Correct 6 ms 2048 KB Output is correct
4 Correct 7 ms 1920 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1920 KB Output is correct
2 Correct 6 ms 1920 KB Output is correct
3 Correct 6 ms 1920 KB Output is correct
4 Correct 6 ms 1920 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1920 KB Output is correct
2 Correct 5 ms 1920 KB Output is correct
3 Correct 6 ms 1920 KB Output is correct
4 Correct 6 ms 1920 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 2224 KB Output is correct
2 Correct 6 ms 2176 KB Output is correct
3 Correct 7 ms 2176 KB Output is correct
4 Correct 6 ms 2176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 2176 KB Output is correct
2 Correct 18 ms 2176 KB Output is correct
3 Correct 9 ms 2176 KB Output is correct
4 Correct 9 ms 2176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 2176 KB Output is correct
2 Correct 6 ms 2432 KB Output is correct
3 Correct 8 ms 2432 KB Output is correct
4 Correct 6 ms 2432 KB Output is correct