/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 324.0 KiB
#2 Time Exceeded ≥2093ms ≥2.484 MiB
#3 Time Exceeded ≥2090ms ≥2.418 MiB

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-11-11 03:33:21
Judged By
Score
10
Total Time
≥2093ms
Peak Memory
≥2.484 MiB