Submission #853515

# Submission time Handle Problem Language Result Execution time Memory
853515 2023-09-24T13:36:57 Z HoriaHaivas Ispit (COCI19_ispit) C++14
0 / 90
8 ms 972 KB
/*
    "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[501][501];

int main()
{
    ifstream fin("secvp.in");
    ofstream fout("secvp.out");
    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=i+1; l<=n && !ok2; l++)
            {
                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
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Incorrect 0 ms 344 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 2 ms 600 KB Output is correct
3 Incorrect 1 ms 856 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 600 KB Output is correct
2 Correct 1 ms 600 KB Output is correct
3 Incorrect 1 ms 600 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 608 KB Output is correct
2 Correct 1 ms 600 KB Output is correct
3 Incorrect 1 ms 600 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 1 ms 856 KB Output is correct
3 Incorrect 1 ms 600 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 604 KB Output is correct
2 Correct 5 ms 860 KB Output is correct
3 Incorrect 5 ms 860 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 600 KB Output is correct
2 Correct 4 ms 856 KB Output is correct
3 Incorrect 4 ms 856 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 604 KB Output is correct
2 Correct 8 ms 972 KB Output is correct
3 Incorrect 5 ms 860 KB Output isn't correct
4 Halted 0 ms 0 KB -