/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 324.0 KiB
#2 Wrong Answer 2ms 320.0 KiB
#3 Wrong Answer 3ms 516.0 KiB

Code

#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main() {
  int t; cin >> t;
  while (t--) {
    int n, ans (0); string s;
    cin >> n >> s;
    map<char,int> L, R;
    for (auto& x:s) R[x]++;
    for (auto& x:s) {
      L[x]++; R[x]--;
      for (int c('a'); c <= 'z'; c++) {
        ans += ((L[c] == R[c]) && (c != x) && L[c] != 0);
      }
    }
    cout << ans << '\n';
  }
}

Information

Submit By
Type
Submission
Problem
P1021 Pivot points
Language
C++17 (G++ 13.2.0)
Submit At
2024-03-26 12:03:06
Judged At
2024-11-11 03:40:14
Judged By
Score
10
Total Time
3ms
Peak Memory
516.0 KiB