Submission #151901

# Submission time Handle Problem Language Result Execution time Memory
151901 2019-09-05T12:07:47 Z phillip Lozinke (COCI17_lozinke) C++14
0 / 100
1000 ms 45656 KB
#include <bits/stdc++.h>

using namespace std;
bool cmp(string a,string b)
{
    if(a.size()<b.size())return true;
    return false;
}
int n;
string s[20009];
map<string,bool>m[20009];
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)cin>>s[i];
    sort(s,s+n,cmp);
    int ans=0;
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            for(int k=0;k<s[j].size()-s[i].size()+1;k++)
            {
                if(s[j].substr(k,s[i].size())==s[i])
                {
                    ans++;
                    cout<<i<<" "<<j<<"\n";
                    break;
                }
            }
            if(s[i]==s[j])ans++,cout<<j<<" "<<i<<"\n";
        }
    }
    cout<<ans;
}

Compilation message

lozinke.cpp: In function 'int main()':
lozinke.cpp:22:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(int k=0;k<s[j].size()-s[i].size()+1;k++)
                         ~^~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 1916 KB Output isn't correct
2 Incorrect 4 ms 1912 KB Output isn't correct
3 Incorrect 5 ms 1912 KB Output isn't correct
4 Incorrect 13 ms 2040 KB Output isn't correct
5 Incorrect 66 ms 2552 KB Output isn't correct
6 Incorrect 100 ms 2012 KB Output isn't correct
7 Incorrect 216 ms 4200 KB Output isn't correct
8 Incorrect 113 ms 1912 KB Output isn't correct
9 Execution timed out 1073 ms 35936 KB Time limit exceeded
10 Execution timed out 1075 ms 1912 KB Time limit exceeded
11 Execution timed out 1065 ms 34892 KB Time limit exceeded
12 Execution timed out 1082 ms 2088 KB Time limit exceeded
13 Execution timed out 1071 ms 2644 KB Time limit exceeded
14 Execution timed out 1083 ms 19672 KB Time limit exceeded
15 Execution timed out 1076 ms 2044 KB Time limit exceeded
16 Execution timed out 1073 ms 2768 KB Time limit exceeded
17 Execution timed out 1079 ms 45656 KB Time limit exceeded
18 Execution timed out 1077 ms 45640 KB Time limit exceeded
19 Execution timed out 1053 ms 2620 KB Time limit exceeded
20 Execution timed out 1080 ms 26832 KB Time limit exceeded