/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 324.0 KiB
#2 Time Exceeded ≥2080ms ≥2.473 MiB
#3 Time Exceeded ≥2086ms ≥2.418 MiB
#4 Time Exceeded ≥2088ms ≥532.0 KiB
#5 Time Exceeded ≥2078ms ≥744.0 KiB
#6 Time Exceeded ≥2081ms ≥564.0 KiB
#7 Accepted 622ms 548.0 KiB
#8 Accepted 109ms 576.0 KiB
#9 Accepted 59ms 576.0 KiB

Code

/**
 *  Author : Shafi
 * 
 ***/
#include <iostream>
#include "vector"
#include "set"
#include "algorithm"
using namespace std;
#define ll long long int

int main() {
    // Write C++ code here
    int tc;
    cin>>tc;
    while(tc--){
        int n;
        cin>>n;
        string str;
        cin>>str;
        if(n<2){
            cout<<"0\n";
        }
        else{
            int cnt = 0;
            for(int i=0;i<n;i++){
                for(int j=i+1;j<n;j++){
                    if(str[i] == str[j]) cnt++;
                }
            }
            cout<<2*cnt<<endl;
        }
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1038 Do not touch my string
Contest
Brain Booster #3
Language
C++20 (G++ 13.2.0)
Submit At
2024-05-06 16:12:01
Judged At
2024-10-03 13:50:42
Judged By
Score
50
Total Time
≥2088ms
Peak Memory
≥2.473 MiB