Submission #141088

# Submission time Handle Problem Language Result Execution time Memory
141088 2019-08-06T16:10:18 Z SeekingOblivion Lozinke (COCI17_lozinke) C++14
0 / 100
314 ms 2604 KB
#include<iostream>
#include<fstream>
#include<cstring>
#include<algorithm>
#include<map>
#include<set>
#define fin cin
#define fout cout
#include<vector>
using namespace std;
//ifstream fin("date.in");
//ofstream fout("date.out");
map<string,int> m;
set<string> s;
set<string>::iterator it;
int n,i,j,h,p,sol;
pair<int,int> v[20010];
string c[20010];
int main(){
    fin>>n;
    for(i=1;i<=n;i++)
    {
        fin>>c[i];
        v[i].first=c[i].size();
        v[i].second=i;
    }
    sort(v+1, v+n+1);
    for(i=1;i<=n;i++)
    {
        s.clear();
        p=v[i].second;
        for(j=0;c[p][j];j++)
            for(h=j;c[p][h];h++)
                s.insert(c[p].substr(j,h-j+1));
        for(it=s.begin();it!=s.end();it++)
            if(m.find(*it)!=m.end()) sol+=m[*it];
        if(m.find(c[p])==m.end())
            m[c[p]]=1;
        else
            m[c[p]]++;
    }
    fout<<sol;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 888 KB Output isn't correct
2 Incorrect 3 ms 888 KB Output isn't correct
3 Incorrect 3 ms 1016 KB Output isn't correct
4 Incorrect 5 ms 1016 KB Output isn't correct
5 Incorrect 11 ms 1016 KB Output isn't correct
6 Incorrect 18 ms 1144 KB Output isn't correct
7 Incorrect 22 ms 1144 KB Output isn't correct
8 Incorrect 28 ms 1016 KB Output isn't correct
9 Incorrect 97 ms 1600 KB Output isn't correct
10 Incorrect 140 ms 1804 KB Output isn't correct
11 Incorrect 152 ms 1864 KB Output isn't correct
12 Incorrect 275 ms 1916 KB Output isn't correct
13 Incorrect 314 ms 2336 KB Output isn't correct
14 Incorrect 209 ms 2604 KB Output isn't correct
15 Incorrect 295 ms 2424 KB Output isn't correct
16 Incorrect 312 ms 1532 KB Output isn't correct
17 Incorrect 79 ms 1400 KB Output isn't correct
18 Incorrect 61 ms 1272 KB Output isn't correct
19 Incorrect 245 ms 2240 KB Output isn't correct
20 Incorrect 163 ms 1400 KB Output isn't correct