이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/*
"vrem gridiuri cu en si capa"
- om intelept - 2023
*/
#include<bits/stdc++.h>
#define debug(x) cerr << #x << " " << x << "\n"
#define debugs(x) cerr << #x << " " << x << " "
#pragma GCC optimize("Ofast")
using namespace std;
char a[501][501];
int f[27][501];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie();
cout.tie();
int i,j,n,k,l,h;
bool ok,ok2;
cin >> n >> k;
for (i=1; i<=n; i++)
{
for (j=1; j<=n; j++)
{
cin >> a[i][j];
}
}
for (i=1; i<=n; i++)
{
for (j=1; j<k; j++)
{
f[a[i][j]-'a'+1][i]++;
}
}
ok2=false;
for (j=k; j<=n && !ok2; j++)
{
for (i=1; i<=n; i++)
{
f[a[i][j]-'a'+1][i]++;
if (j>k)
f[a[i][j-k]-'a'+1][i]--;
}
for (i=1; i<=n && !ok2; i++)
{
for (l=1; l<=n && !ok2; l++)
{
if (l!=i)
{
ok=true;
for (h=1; h<=26 && ok; h++)
{
if (f[h][i]!=f[h][l])
ok=false;
}
if (ok==true)
ok2=true;
}
}
}
}
if (ok2)
cout << "DA\n";
else
cout << "NE\n";
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... |