Submission #661328

# Submission time Handle Problem Language Result Execution time Memory
661328 2022-11-25T13:59:32 Z Trisanu_Das Lozinke (COCI17_lozinke) C++17
100 / 100
174 ms 15996 KB
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  	int n; cin >> n;
    string a[n];
    unordered_set<string> s;
    unordered_map<string, int> m;
  	for(int i = 0;i < n; i++){
  	  	cin >> a[i];
    	s.clear();
    	for(int j = 0;j < a[i].size(); j++){
      		string ss;
      		for(int k = j; k < a[i].size(); k++){
        		ss += a[i][k]; s.insert(ss);
      		}
    	}
        for(auto &x : s) m[x]++;
  	}
  	int ans = 0;
  	for(auto &x:a) ans += m[x];
  	cout << ans - n << '\n';
}

Compilation message

lozinke.cpp: In function 'int main()':
lozinke.cpp:12:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |      for(int j = 0;j < a[i].size(); j++){
      |                    ~~^~~~~~~~~~~~~
lozinke.cpp:14:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |         for(int k = j; k < a[i].size(); k++){
      |                        ~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 5 ms 596 KB Output is correct
6 Correct 5 ms 596 KB Output is correct
7 Correct 7 ms 1364 KB Output is correct
8 Correct 15 ms 2196 KB Output is correct
9 Correct 32 ms 2296 KB Output is correct
10 Correct 69 ms 7956 KB Output is correct
11 Correct 49 ms 4392 KB Output is correct
12 Correct 163 ms 15996 KB Output is correct
13 Correct 90 ms 2636 KB Output is correct
14 Correct 127 ms 15804 KB Output is correct
15 Correct 174 ms 15912 KB Output is correct
16 Correct 95 ms 1052 KB Output is correct
17 Correct 55 ms 852 KB Output is correct
18 Correct 37 ms 908 KB Output is correct
19 Correct 100 ms 8308 KB Output is correct
20 Correct 52 ms 1024 KB Output is correct