Submission #661321

# Submission time Handle Problem Language Result Execution time Memory
661321 2022-11-25T13:49:23 Z Trisanu_Das Lozinke (COCI17_lozinke) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

int main(){
  int n; cin >> n;
  string a[n]; for(int i = 0; i < n; i++) cin >> a[i];
  set<string> s;
  map<string, int> mp
  int ans = 0;
  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

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