Wrong Answer
Code
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
string s;
cin >> s;
vector<char> l(s.begin(), s.end());
set<char> se(s.begin(), s.end());
int pair = 0;
for (auto i : se) {
int count = 0;
for (auto j : l) {
if (i == j) {
count++;
}
}
pair += (count * (count - 1));
}
cout << pair << endl;
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1038 Do not touch my string
- Language
- C++20 (G++ 13.2.0)
- Submit At
- 2024-05-20 21:18:10
- Judged At
- 2024-11-11 03:29:56
- Judged By
- Score
- 10
- Total Time
- 30ms
- Peak Memory
- 2.391 MiB