Submission #862184

#TimeUsernameProblemLanguageResultExecution timeMemory
862184TAhmed33Set (COCI21_set)C++98
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; string op (string a, string b) { string ret; for (int i = 0; i < (int)a.length(); i++) { if (a[i] == b[i]) ret += a[i]; else { set <char> x = {'1', '2', '3'}; x.erase(a[i]); x.erase(b[i]); ret += *(x.begin()); } } return ret; } string op2[2188][2188]; int main () { int n, m; cin >> n >> m; string arr[n]; for (int i = 0; i < n; i++) cin >> arr[i]; for (int i = 0; i < n; i++) { for (int j = 0; j < i; j++) { op2[i][j] = op(arr[i], arr[j]); } } long long ans = 0; for (int i = 0; i < n; i++) { unordered_map <string, int> freq2; for (int j = 0; j < i; j++) { if (arr[i] == arr[j]) continue; ans += freq2[op2[i][j]]; freq2[arr[j]]++; } ans += freq2[arr[i]] * (cnt[arr[i]] - 1) / 2; } cout << ans << '\n'; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:34:27: error: 'cnt' was not declared in this scope; did you mean 'int'?
   34 |   ans += freq2[arr[i]] * (cnt[arr[i]] - 1) / 2;
      |                           ^~~
      |                           int