답안 #232476

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
232476 2020-05-17T07:12:42 Z NONAME Ispit (COCI19_ispit) C++17
0 / 90
38 ms 29568 KB
#include <bits/stdc++.h>
#define sz(x) int(x.size())
#define in(x) freopen(x, "r", stdin)
#define out(x) freopen(x, "w", stdout)
#define N 100500
#define oo ll(1e16)
#define ft first
#define sd second
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define el '\n'
#define elf endl
#define base ll(1e9 + 7)
using namespace std;
typedef long long ll;
typedef long double ld;

int n, k;
int pf[501][501][26];
string s[N];

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

//    in("input.txt");

    cin >> n >> k;

    for (int i = 0; i < n; i++) {
        cin >> s[i];

        for (int j = 0; j < n; j++) {
            for (int t = 0; t < 26; t++)
                pf[i][j][t] = (j - 1 < 0 ? 0 : pf[i][j - 1][t]);

            pf[i][j][s[i][j] - 'a']++;
        }
    }

    for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) {
        bool f = 1;
        for (int t = 0; t < 26; t++)
            if ((pf[i][n - 1][t] == 0 && pf[j][n - 1][t] != 0) || (pf[i][n - 1][t] != 0 && pf[j][n - 1][t] == 0))
                f = 0;

        if (!f)
            continue;

        f = 0;

        for (int t = 0; t + k - 1 < n && !f; t++) {
            bool gd = 1;
            for (int l = 0; l < 26 && gd; l++)
                if ((pf[i][t + k - 1][l] - (t - 1 < 0 ? 0 : pf[i][t - 1][l])) != (pf[j][t + k - 1][l] - (t - 1 < 0 ? 0 : pf[j][t - 1][l])))
                    gd = 0;

            f |= gd;
        }

        if (f) {
            cout << "DA";
            return 0;
        }
    }

    cout << "NE";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 3584 KB Output is correct
2 Correct 6 ms 3584 KB Output is correct
3 Incorrect 6 ms 3584 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 3584 KB Output is correct
2 Correct 6 ms 3584 KB Output is correct
3 Incorrect 6 ms 3584 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 3584 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 8448 KB Output is correct
2 Correct 10 ms 8448 KB Output is correct
3 Incorrect 10 ms 8448 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 8448 KB Output is correct
2 Correct 10 ms 8448 KB Output is correct
3 Incorrect 10 ms 8448 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 8448 KB Output is correct
2 Correct 10 ms 8448 KB Output is correct
3 Incorrect 9 ms 8448 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 8448 KB Output is correct
2 Correct 10 ms 8448 KB Output is correct
3 Incorrect 10 ms 8448 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 29440 KB Output is correct
2 Correct 31 ms 29416 KB Output is correct
3 Incorrect 23 ms 29440 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 38 ms 29440 KB Output is correct
2 Correct 27 ms 29568 KB Output is correct
3 Incorrect 24 ms 29440 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 29440 KB Output is correct
2 Correct 26 ms 29440 KB Output is correct
3 Incorrect 26 ms 29528 KB Output isn't correct
4 Halted 0 ms 0 KB -