Submission #44579

# Submission time Handle Problem Language Result Execution time Memory
44579 2018-04-03T12:26:50 Z heon Lozinke (COCI17_lozinke) C++11
100 / 100
594 ms 17804 KB
#include<iostream>
#include<map>
#include<set>

using namespace std;

#define MAXN 20005

int n;
string arr[MAXN];
map <string,int> mp;
set <string> v;
int sol = 0;

int main(){
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> arr[i];
		v.clear();
		for(int j = 0; j < arr[i].size(); j++){
			string curr;
			for(int l = j; l < arr[i].size(); l++){
				curr.push_back(arr[i][l]);
				v.insert(curr);
			}
		}
		for(auto& j : v){
			mp[j]++;
		}
	}
	for(auto& x : arr){
		sol += mp[x];
	}
	cout << sol - n;
}

Compilation message

lozinke.cpp: In function 'int main()':
lozinke.cpp:20:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j = 0; j < arr[i].size(); j++){
                  ~~^~~~~~~~~~~~~~~
lozinke.cpp:22:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int l = j; l < arr[i].size(); l++){
                   ~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 888 KB Output is correct
2 Correct 3 ms 1000 KB Output is correct
3 Correct 4 ms 1184 KB Output is correct
4 Correct 4 ms 1184 KB Output is correct
5 Correct 13 ms 1492 KB Output is correct
6 Correct 20 ms 1504 KB Output is correct
7 Correct 27 ms 2424 KB Output is correct
8 Correct 51 ms 3316 KB Output is correct
9 Correct 109 ms 3320 KB Output is correct
10 Correct 232 ms 8340 KB Output is correct
11 Correct 178 ms 8340 KB Output is correct
12 Correct 594 ms 17660 KB Output is correct
13 Correct 323 ms 17660 KB Output is correct
14 Correct 379 ms 17660 KB Output is correct
15 Correct 564 ms 17804 KB Output is correct
16 Correct 326 ms 17804 KB Output is correct
17 Correct 75 ms 17804 KB Output is correct
18 Correct 57 ms 17804 KB Output is correct
19 Correct 387 ms 17804 KB Output is correct
20 Correct 145 ms 17804 KB Output is correct