Submission #74549

# Submission time Handle Problem Language Result Execution time Memory
74549 2018-09-03T12:40:11 Z ZZangZZang Lozinke (COCI17_lozinke) C++17
0 / 100
698 ms 17240 KB
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
#include <cstring>
#include <functional>
#include <string>
#include <set>
#include <map>

typedef long long ll;
using namespace std;

ll n, sol = 0;
string s[20001];
map<string, ll> ms;

int main()
{
	scanf("%lld", &n);
	for(ll i=0; i<n; i++)
	{
		char str[20]; scanf("%s", str);
		s[i] = string(str);
        if(ms.find(s[i]) == ms.end()) ms.insert(make_pair(s[i], 0));
        else ms[s[i]]++;
	}
	for(ll k=0; k<n; k++)
	{
		set<string> l;
		vector<string> v;
		for(ll i=0; i<s[k].size(); i++)
		{
			string tmp;
			for(ll j=i; j<s[k].size(); j++)
			{
				tmp += s[k][j];
				if(l.find(tmp) == l.end()) l.insert(tmp), v.push_back(tmp);
			}
		}
		for(ll i=0; i<v.size(); i++)
		{
			if(v[i] == s[k]) sol += (ll)(ms[v[i]] - 1);
			else sol += (ll)(ms[v[i]]);
		}
	}
	printf("%lld", sol);
	return 0;
}

Compilation message

lozinke.cpp: In function 'int main()':
lozinke.cpp:32:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(ll i=0; i<s[k].size(); i++)
               ~^~~~~~~~~~~~
lozinke.cpp:35:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(ll j=i; j<s[k].size(); j++)
                ~^~~~~~~~~~~~
lozinke.cpp:41:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(ll i=0; i<v.size(); i++)
               ~^~~~~~~~~
lozinke.cpp:20:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld", &n);
  ~~~~~^~~~~~~~~~~~
lozinke.cpp:23:22: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   char str[20]; scanf("%s", str);
                 ~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 888 KB Output isn't correct
2 Incorrect 2 ms 1012 KB Output isn't correct
3 Incorrect 3 ms 1216 KB Output isn't correct
4 Incorrect 4 ms 1216 KB Output isn't correct
5 Incorrect 16 ms 1468 KB Output isn't correct
6 Incorrect 25 ms 1484 KB Output isn't correct
7 Incorrect 37 ms 2264 KB Output isn't correct
8 Incorrect 55 ms 3032 KB Output isn't correct
9 Incorrect 143 ms 3032 KB Output isn't correct
10 Incorrect 319 ms 8040 KB Output isn't correct
11 Incorrect 237 ms 8040 KB Output isn't correct
12 Incorrect 637 ms 17240 KB Output isn't correct
13 Incorrect 426 ms 17240 KB Output isn't correct
14 Incorrect 447 ms 17240 KB Output isn't correct
15 Incorrect 698 ms 17240 KB Output isn't correct
16 Incorrect 421 ms 17240 KB Output isn't correct
17 Incorrect 70 ms 17240 KB Output isn't correct
18 Incorrect 54 ms 17240 KB Output isn't correct
19 Incorrect 473 ms 17240 KB Output isn't correct
20 Incorrect 214 ms 17240 KB Output isn't correct