/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Wrong Answer 1ms 312.0 KiB
#2 Time Exceeded ≥2076ms ≥1.309 MiB

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;

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

                }
            }
        }


        printf("%d\n", count);
        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:44:43
Judged At
2024-11-11 03:31:56
Judged By
Score
0
Total Time
≥2076ms
Peak Memory
≥1.309 MiB