/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 320.0 KiB
#2 Time Exceeded ≥2091ms ≥1.27 MiB
#3 Time Exceeded ≥2081ms ≥1.27 MiB

Code

#include <iostream>
using namespace std;

//SAYED AL MAMUN_LU

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        char samp[n];
        for(int h = 0; h<n; h++)
        {
            cin>>samp[h];
        }
        
        int hop = sizeof(samp);
        int sum = 0;
        for(int i = 0; i < hop - 1; i++)
        {
            for(int j = i + 1; j < hop; j++)
            {
                if(samp[i] == samp[j])
                {
                    sum++;
                    
                }
            }
        }
        
        cout<<2*sum<<endl;
        
        
    }
}

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 17:48:08
Judged At
2024-11-11 03:31:51
Judged By
Score
10
Total Time
≥2091ms
Peak Memory
≥1.27 MiB