Submission #472766

# Submission time Handle Problem Language Result Execution time Memory
472766 2021-09-14T09:56:14 Z MamdouhN Lozinke (COCI17_lozinke) C++14
0 / 100
1000 ms 6556 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"

int n,ans;
string password[200002];
map<string,bool>idk;

void check(string a,string b)
{
    idk.clear();
    string x;
    for(int i=0;i<a.size();i++)
    {
        x+=a[i];
        if(x.size()<=b.size())idk[x]=1;
        string y;
        int j = i;
        while(j>=0&&y.size()>b.size())
        {
            y=a[j]+y;
            idk[y]=1;
            j--;
        }
    }
    if(idk[b])ans++;
}

main()
{
    cin>>n;
    for(int i=0;i<n;i++)cin>>password[i];
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            if(j==i)continue;
            if(password[j].size()>password[i].size())continue;
            //cout<<password[i]<<" "<<password[j]<<endl;
            check(password[i],password[j]);
            //cout<<ans<<endl;
        }
    }
    cout<<ans<<endl;
}

Compilation message

lozinke.cpp: In function 'void check(std::string, std::string)':
lozinke.cpp:14:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |     for(int i=0;i<a.size();i++)
      |                 ~^~~~~~~~~
lozinke.cpp: At global scope:
lozinke.cpp:30:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   30 | main()
      | ^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 6476 KB Output isn't correct
2 Incorrect 4 ms 6476 KB Output isn't correct
3 Incorrect 6 ms 6556 KB Output isn't correct
4 Incorrect 49 ms 6532 KB Output isn't correct
5 Incorrect 285 ms 6544 KB Output isn't correct
6 Incorrect 882 ms 6536 KB Output isn't correct
7 Execution timed out 1094 ms 6476 KB Time limit exceeded
8 Execution timed out 1093 ms 6476 KB Time limit exceeded
9 Execution timed out 1081 ms 6476 KB Time limit exceeded
10 Execution timed out 1093 ms 6476 KB Time limit exceeded
11 Execution timed out 1095 ms 6476 KB Time limit exceeded
12 Execution timed out 1094 ms 6476 KB Time limit exceeded
13 Execution timed out 1097 ms 6476 KB Time limit exceeded
14 Execution timed out 1086 ms 6476 KB Time limit exceeded
15 Execution timed out 1089 ms 6476 KB Time limit exceeded
16 Execution timed out 1087 ms 6476 KB Time limit exceeded
17 Execution timed out 1058 ms 6476 KB Time limit exceeded
18 Execution timed out 1090 ms 6476 KB Time limit exceeded
19 Execution timed out 1080 ms 6476 KB Time limit exceeded
20 Execution timed out 1087 ms 6476 KB Time limit exceeded