Time Exceeded
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:58:38
- Judged At
- 2024-11-11 03:31:43
- Judged By
- Score
- 10
- Total Time
- ≥2094ms
- Peak Memory
- ≥1.27 MiB