Submission #4032166


Source Code Expand

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,i=0,temp=0;
    scanf("%d",&n);
    unsigned long a[n],x[2];
    unsigned long long area;
    for(i;i<n;i++)
    {
        scanf("%lu",&a[i]);
    }
    sort(a,a+n,greater<unsigned long>());
    i=0;
    for(i;i<n;i++)
    {
        if(a[i]==a[i+1])
        {
            x[temp]=a[i];
            temp++;
            i++;
        }

        if(temp==2)
            break;
    }
    if(temp==2)
    {
        area=x[0]*x[1];
        printf("%llu" , area);
    }
    else
        printf("0");




}

Submission Info

Submission Time
Task C - Make a Rectangle
User vjudge3
Language C++14 (GCC 5.4.1)
Score 300
Code Size 569 Byte
Status AC
Exec Time 19 ms
Memory 1024 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:8:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
                   ^
./Main.cpp:13:27: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lu",&a[i]);
                           ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 15
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 AC 19 ms 1024 KB
2.txt AC 8 ms 640 KB
3.txt AC 19 ms 1024 KB
4.txt AC 19 ms 1024 KB
5.txt AC 8 ms 640 KB
6.txt AC 15 ms 1024 KB
7.txt AC 15 ms 1024 KB
8.txt AC 7 ms 512 KB
9.txt AC 10 ms 640 KB
sample1.txt AC 1 ms 256 KB
sample2.txt AC 1 ms 256 KB
sample3.txt AC 1 ms 256 KB