Submission #170361

# Submission time Handle Problem Language Result Execution time Memory
170361 2019-12-24T21:59:56 Z mdn2002 Lozinke (COCI17_lozinke) C++14
75 / 100
1000 ms 61776 KB
#include<bits/stdc++.h>
using namespace std;
const long long mod=998244353;
int n,ans;
map<string,int>mp;
map<pair<string,int>,int>m;
vector<string>v;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    //freopen("lemonade.in","r",stdin);
    //freopen("lemonade.out","w",stdout);
    cin>>n;
    for(int i=0;i<n;i++)
    {
        string s;
        cin>>s;
        v.push_back(s);
        mp[s]++;
    }
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<v[i].size();j++)
        {
            string s;
            for(int z=j;z<v[i].size();z++)
            {
                s.push_back(v[i][z]);
                if(m[{s,i}]==0)
                {
                    ans+=mp[s];
                    m[{s,i}]++;
                }
            }
        }
    }
    cout<<ans-n;
}

Compilation message

lozinke.cpp: In function 'int main()':
lozinke.cpp:25:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j=0;j<v[i].size();j++)
                     ~^~~~~~~~~~~~
lozinke.cpp:28:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(int z=j;z<v[i].size();z++)
                         ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 4 ms 504 KB Output is correct
4 Correct 5 ms 760 KB Output is correct
5 Correct 27 ms 2684 KB Output is correct
6 Correct 51 ms 4068 KB Output is correct
7 Correct 62 ms 5300 KB Output is correct
8 Correct 103 ms 8312 KB Output is correct
9 Correct 335 ms 20080 KB Output is correct
10 Correct 661 ms 37412 KB Output is correct
11 Correct 579 ms 31472 KB Output is correct
12 Execution timed out 1070 ms 60636 KB Time limit exceeded
13 Execution timed out 1075 ms 53216 KB Time limit exceeded
14 Correct 971 ms 54660 KB Output is correct
15 Execution timed out 1075 ms 61776 KB Time limit exceeded
16 Execution timed out 1074 ms 56132 KB Time limit exceeded
17 Correct 534 ms 20076 KB Output is correct
18 Correct 361 ms 16236 KB Output is correct
19 Execution timed out 1091 ms 55656 KB Time limit exceeded
20 Correct 643 ms 35868 KB Output is correct