답안 #200097

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
200097 2020-02-05T10:22:09 Z Saboon Ispit (COCI19_ispit) C++14
90 / 90
36 ms 892 KB
/**
 *    author:  Atreus
 *    created: 09.02.2019
**/
#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";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 380 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 36 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 380 KB Output is correct
4 Correct 6 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 380 KB Output is correct
2 Correct 6 ms 552 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 504 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 888 KB Output is correct
2 Correct 6 ms 888 KB Output is correct
3 Correct 6 ms 892 KB Output is correct
4 Correct 6 ms 888 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 888 KB Output is correct
2 Correct 18 ms 888 KB Output is correct
3 Correct 6 ms 892 KB Output is correct
4 Correct 8 ms 888 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 888 KB Output is correct
2 Correct 6 ms 888 KB Output is correct
3 Correct 7 ms 888 KB Output is correct
4 Correct 6 ms 888 KB Output is correct