Submission #100862

# Submission time Handle Problem Language Result Execution time Memory
100862 2019-03-14T22:06:34 Z Ort Ispit (COCI19_ispit) C++11
0 / 90
22 ms 1152 KB
#include<iostream>
#include<string>
#include<algorithm>
#define MAX 505

using namespace std;

int n, k;
bool ok = 0;

string mat[MAX];
string smat[MAX];
string s;


int main() {
	cin.sync_with_stdio(0); cin.tie(0);
	cin.exceptions(cin.failbit);
	cin >> n >> k;
	for(int i=0;i<n;i++) {
		cin >> s;
		mat[i] = s;
		sort(s.begin(),s.end());
		smat[i] = s;
	}
	int cnt = 0;
	for(int i=0;i<n;i++) {
		for(int j=0;j<n;j++) {
			if(i==j) continue;
			if(smat[i]==mat[j] || smat[j]==mat[i]) {
				cout << "DA";
				return 0;	
			}
			if(smat[i]==smat[j]) {
				for(int z=0;z<n;z++) {
					if(mat[i][z]==mat[j][z]) continue;
					else cnt++;
					if(cnt<=k) {
						cout << "DA";
						return 0;
					}
				}
				cnt = 0;
			}
		}
	}
	cout << "NE";
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Incorrect 2 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 456 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Incorrect 2 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 512 KB Output is correct
2 Correct 4 ms 512 KB Output is correct
3 Incorrect 4 ms 512 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 512 KB Output is correct
2 Correct 4 ms 512 KB Output is correct
3 Incorrect 4 ms 512 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 512 KB Output is correct
2 Correct 12 ms 512 KB Output is correct
3 Incorrect 4 ms 512 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 512 KB Output is correct
2 Correct 4 ms 596 KB Output is correct
3 Incorrect 3 ms 512 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 21 ms 1152 KB Output is correct
2 Correct 16 ms 1152 KB Output is correct
3 Incorrect 13 ms 1152 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 19 ms 1152 KB Output is correct
2 Correct 12 ms 1132 KB Output is correct
3 Incorrect 12 ms 1152 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 22 ms 1152 KB Output is correct
2 Correct 10 ms 1152 KB Output is correct
3 Incorrect 11 ms 1152 KB Output isn't correct
4 Halted 0 ms 0 KB -