Submission #7113667


Source Code Expand

Copy
#include<stdio.h>

#define MAX 2000

int N, K, A[MAX];

int main(void){
    int i, j;
    int bf=0,af=0;

    scanf("%d%d", &N, &K);
    for (i = 0; i < N; i++){
        scanf("%d", &A[i]);
    }

    for (i = 0; i < N; i++){
        for (j = 0; j < i; j++){
            if(A[i]>A[j])
                bf++;
        }
        for (j = i; j < N; j++){
            if(A[i]>A[j])
                af++;
        }
    }

    printf("%d", (af * K * (K + 1) / 2 - bf * K * (K - 1) / 2) % 1000000007);

    return 0;
}

Submission Info

Submission Time
Task B - Kleene Inversion
User rouge_0000
Language C (GCC 5.4.1)
Score 0
Code Size 540 Byte
Status WA
Exec Time 4 ms
Memory 128 KB

Compile Error

./Main.c: In function ‘main’:
./Main.c:11:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &N, &K);
     ^
./Main.c:13:9: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &A[i]);
         ^

Judge Result

Set Name All Sample
Score / Max Score 0 / 300 0 / 0
Status
AC × 5
WA × 19
AC × 2
WA × 1
Set Name Test Cases
All sample_01, sample_02, sample_03, testcase_0, testcase_1, testcase_10, testcase_11, testcase_12, testcase_13, testcase_14, testcase_15, testcase_16, testcase_17, testcase_18, testcase_19, testcase_2, testcase_20, testcase_3, testcase_4, testcase_5, testcase_6, testcase_7, testcase_8, testcase_9
Sample sample_01, sample_02, sample_03
Case Name Status Exec Time Memory
sample_01 AC 1 ms 128 KB
sample_02 AC 1 ms 128 KB
sample_03 WA 1 ms 128 KB
testcase_0 WA 1 ms 128 KB
testcase_1 WA 1 ms 128 KB
testcase_10 WA 1 ms 128 KB
testcase_11 WA 1 ms 128 KB
testcase_12 WA 1 ms 128 KB
testcase_13 WA 2 ms 128 KB
testcase_14 WA 1 ms 128 KB
testcase_15 WA 1 ms 128 KB
testcase_16 WA 1 ms 128 KB
testcase_17 WA 1 ms 128 KB
testcase_18 WA 2 ms 128 KB
testcase_19 WA 2 ms 128 KB
testcase_2 WA 1 ms 128 KB
testcase_20 WA 3 ms 128 KB
testcase_3 WA 1 ms 128 KB
testcase_4 WA 1 ms 128 KB
testcase_5 AC 1 ms 128 KB
testcase_6 AC 1 ms 128 KB
testcase_7 AC 4 ms 128 KB
testcase_8 WA 4 ms 128 KB
testcase_9 WA 4 ms 128 KB