Submission #661322

#TimeUsernameProblemLanguageResultExecution timeMemory
661322Trisanu_DasLozinke (COCI17_lozinke)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; string a[n]; set<string> s; map<string, int> mp for(int i = 0; i < n; i++){ cin >> a[i]; 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); } } } int ans = 0; for(string ss : s) m[ss]++; for(string ss : m) ans += m[ss]++; cout << ans - n << '\n'; }

Compilation message (stderr)

lozinke.cpp: In function 'int main()':
lozinke.cpp:9:3: error: expected initializer before 'for'
    9 |   for(int i = 0; i < n; i++){
      |   ^~~
lozinke.cpp:9:18: error: 'i' was not declared in this scope
    9 |   for(int i = 0; i < n; i++){
      |                  ^
lozinke.cpp:20:22: error: 'm' was not declared in this scope
   20 |   for(string ss : s) m[ss]++;
      |                      ^
lozinke.cpp:21:19: error: 'm' was not declared in this scope
   21 |   for(string ss : m) ans += m[ss]++;
      |                   ^