Submission #250765

# Submission time Handle Problem Language Result Execution time Memory
250765 2020-07-19T05:31:49 Z dvdg6566 Ispit (COCI19_ispit) C++14
90 / 90
1628 ms 1284 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef pair<pi,int> pii;
#define pb emplace_back
#define mp make_pair
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define ALL(X) X.begin(),X.end()
#define SZ(X) (int)X.size()
#define MAXN 510
#define INF 1e15

unordered_map<string,bool> M;
string A[MAXN];
int N,K;

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    // freopen("in.txt","r",stdin);
    cin>>N>>K;
    for (int i=1;i<=N;++i)cin>>A[i];
    for (int l=0;l+K<=N;++l){
        int r=l+K-1;
        // cout<<l<<' '<<r<<'\n';
        M.clear();
        for (int j=1;j<=N;++j){
            string tmp = "", st = "";
            for (int i=0;i<l;++i)tmp += A[j][i];
            for (int i=r+1;i<N;++i)tmp += A[j][i];
            for (int i=l;i<=r;++i)st+=A[j][i];
            sort(ALL(st));
            for (auto i :st)tmp+=i;
            if (M[tmp] == 1){
                cout<<"DA";
                return 0;
            }
            else M[tmp]=1;
        }
    }
    cout<<"NE";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 12 ms 556 KB Output is correct
2 Correct 19 ms 512 KB Output is correct
3 Correct 120 ms 632 KB Output is correct
4 Correct 104 ms 632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 512 KB Output is correct
2 Correct 11 ms 512 KB Output is correct
3 Correct 118 ms 632 KB Output is correct
4 Correct 11 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 512 KB Output is correct
2 Correct 5 ms 512 KB Output is correct
3 Correct 81 ms 512 KB Output is correct
4 Correct 9 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 512 KB Output is correct
2 Correct 2 ms 512 KB Output is correct
3 Correct 119 ms 556 KB Output is correct
4 Correct 51 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 88 ms 1152 KB Output is correct
2 Correct 108 ms 1272 KB Output is correct
3 Correct 536 ms 1284 KB Output is correct
4 Correct 109 ms 1152 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 94 ms 1152 KB Output is correct
2 Correct 4 ms 1024 KB Output is correct
3 Correct 1628 ms 1272 KB Output is correct
4 Correct 391 ms 1276 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 61 ms 1152 KB Output is correct
2 Correct 143 ms 1152 KB Output is correct
3 Correct 1575 ms 1272 KB Output is correct
4 Correct 125 ms 1192 KB Output is correct