Submission #4032129


Source Code Expand

#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
void merge_sort(int* data,int _sz){
    if(_sz>1){
        int leftsz=_sz/2,rightsz=_sz-leftsz;
        int left[leftsz];
        int right[rightsz];
        int i,j=0,k;
        for(i=0;i<_sz;i++){
            if(i<leftsz){
                left[i]=data[i];
            }
            else{
                right[j]=data[i];
                j++;
            }
        }
        merge_sort(left,leftsz);
        merge_sort(right,rightsz);
        j=0;
        k=0;
        for(i=0;i<_sz;i++){
            if(j==leftsz){
                while(i<_sz){
                    data[i]=right[k];
                    k++;
                    i++;
                }
                return;
            }
            else if(k==rightsz){
                while(i<_sz){
                    data[i]=left[j];
                    j++;
                    i++;
                }
            }
            else if(left[j]<right[k]){
                data[i]=left[j];
                j++;
            }
            else{
                data[i]=right[k];
                k++;
            }
        }
        return;
    }
    return;
}
int main(){
    int n,tmp,i,j;
    int64_t rec[2]={0,0};
    int data[100000];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",data+i);
    }
    merge_sort(data,n);
    j=0;
    for(i=n-1;i>0;i--){
        if(data[i]==data[i-1]){
            rec[j]=(int64_t)data[i];
            i--;
            j++;
        }
        if(j==2)break;
    }
    if(j!=2){
        printf("0");
        return 0;
    }
    printf("%I64d",rec[0]*rec[1]);
    return 0;

}

Submission Info

Submission Time
Task C - Make a Rectangle
User vjudge5
Language C (GCC 5.4.1)
Score 0
Code Size 1638 Byte
Status WA
Exec Time 25 ms
Memory 1280 KB

Compile Error

./Main.c: In function ‘main’:
./Main.c:74:12: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘int64_t {aka long int}’ [-Wformat=]
     printf("%I64d",rec[0]*rec[1]);
            ^
./Main.c:56:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
     ^
./Main.c:58:9: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",data+i);
         ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 3
AC × 7
WA × 8
Set Name Test Cases
Sample sample1.txt, sample2.txt, sample3.txt
All sample1.txt, sample2.txt, sample3.txt, 1.txt, 2.txt, 3.txt, 4.txt, 5.txt, 6.txt, 7.txt, 8.txt, 9.txt, sample1.txt, sample2.txt, sample3.txt
Case Name Status Exec Time Memory
1.txt WA 25 ms 1280 KB
2.txt WA 10 ms 768 KB
3.txt WA 25 ms 1280 KB
4.txt WA 25 ms 1280 KB
5.txt WA 10 ms 768 KB
6.txt WA 21 ms 1280 KB
7.txt WA 21 ms 1280 KB
8.txt WA 9 ms 640 KB
9.txt AC 13 ms 768 KB
sample1.txt AC 1 ms 128 KB
sample2.txt AC 1 ms 128 KB
sample3.txt AC 1 ms 128 KB