이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#define FOR(i,n) for(int i=0;i<n;i++)
#define FORE(i,a,b) for(int i = a;i<=b;i++)
#define ll long long int
#define pb push_back
#define vi vector<int>
#define ff first
#define ss second
#define vv vector
#define ii pair<int,int>
using namespace std;
const int MAXN = 501;
char grid[MAXN][MAXN];
int compo[MAXN][26];
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int n,k;
cin >> n >> k;
FOR(i,n){
string s;cin >> s;
FOR(j,n)grid[i][j] = s[j],compo[i][s[j]-'a']++;
}
bool ok = 0;
FOR(i,n){
FOR(j,n){
if(i >= j)continue;
bool b = 1;
FOR(a,26){
if(compo[i][a] != compo[j][a])b = 0;
}
if(!b)continue;
int ctr = 0;
FOR(a,n)ctr += grid[i][a] != grid[j][a];
//cout << i << " " << j << endl;
if(ctr <= k)ok = 1;
}
}
if(ok)cout << "DA" << endl;
else cout << "NE" << endl;
return 0;
}
# | 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... |