/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 0ms 284.0 KiB
#2 Time Exceeded ≥2081ms ≥1.496 MiB
#3 Time Exceeded ≥2081ms ≥1.27 MiB
#4 Time Exceeded ≥2079ms ≥516.0 KiB
#5 Time Exceeded ≥2071ms ≥284.0 KiB
#6 Wrong Answer 82ms 436.0 KiB
#7 Accepted 850ms 516.0 KiB
#8 Accepted 99ms 460.0 KiB
#9 Wrong Answer 39ms 428.0 KiB

Code

#include <stdio.h>

int main(){

    int x = 0, t;

    scanf("%d", &t);

    while(x < t){
        int n;

        scanf("%d", &n);

        char p[n];
        scanf("%s", &p);
        int count = 0;


        if (n < 2){
            printf("0\n");
            goto Down;
        }
        if(n > 1){
            for(int i = 0; i < n; i++){
                for (int j = i+1; j < n ; j++){
                    if(p[i] == p[j]){
                        count++;
                    }

                }
            }
        }


        printf("%d\n", count*2);
        Down:
        x++;
    }

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1038 Do not touch my string
Contest
Brain Booster #3
Language
C99 (GCC 13.2.0)
Submit At
2024-05-06 17:35:43
Judged At
2024-10-03 13:48:26
Judged By
Score
30
Total Time
≥2081ms
Peak Memory
≥1.496 MiB