Submission #515731

# Submission time Handle Problem Language Result Execution time Memory
515731 2022-01-19T14:46:44 Z MurotY Lozinke (COCI17_lozinke) C++14
100 / 100
429 ms 16812 KB
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=22222;
string a[N];
int main()
{
	int n;
	cin >> n;
	for (int i=1;i<=n;i++) cin >> a[i];
	map <string, int> mp;
	int ans=0;
	for (int i=1;i<=n;i++){
		map <string , int> mp1;
		for (int j=0;j<a[i].size();j++){
			string s;
			for (int j1=j;j1<a[i].size();j1++){
				s=s+a[i][j1];
			//	cout << s <<"\n";
				if (mp1[s] == 0) mp1[s]++, mp[s]++;
			}
		}
	}
	for (int i=1;i<=n;i++) ans+=mp[a[i]]-1;
	cout << ans;
	return 0;
}

Compilation message

lozinke.cpp: In function 'int main()':
lozinke.cpp:15:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |   for (int j=0;j<a[i].size();j++){
      |                ~^~~~~~~~~~~~
lozinke.cpp:17:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |    for (int j1=j;j1<a[i].size();j1++){
      |                  ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 972 KB Output is correct
2 Correct 1 ms 984 KB Output is correct
3 Correct 2 ms 984 KB Output is correct
4 Correct 2 ms 972 KB Output is correct
5 Correct 9 ms 1368 KB Output is correct
6 Correct 14 ms 1256 KB Output is correct
7 Correct 19 ms 2076 KB Output is correct
8 Correct 30 ms 2908 KB Output is correct
9 Correct 81 ms 2812 KB Output is correct
10 Correct 159 ms 7812 KB Output is correct
11 Correct 131 ms 4456 KB Output is correct
12 Correct 364 ms 16812 KB Output is correct
13 Correct 255 ms 2940 KB Output is correct
14 Correct 254 ms 15044 KB Output is correct
15 Correct 429 ms 16564 KB Output is correct
16 Correct 259 ms 1248 KB Output is correct
17 Correct 80 ms 1120 KB Output is correct
18 Correct 56 ms 1144 KB Output is correct
19 Correct 269 ms 8684 KB Output is correct
20 Correct 141 ms 1212 KB Output is correct