Submission #4049405
Source Code Expand
#include<bits/stdc++.h>
using namespace std;
int arra[100001];
int main()
{
int N,a,b,i,j;
scanf("%d",&N);
for(i=0;i<N;i++)
scanf("%d",&arra[i]);
sort(arra,arra+N,greater<int>());
bool a_found=false,b_found=false;
for(i=0,j=1;j<N;i++,j++){
if(arra[i]==arra[j]){
a_found=true;
a=arra[i];
break;
}
}
if(a_found){
for(i=j+1,j=j+2;j<N;j++,i++){
if(arra[i]==arra[j]){
b_found=true;
b=arra[i];
break;
}
}
}
if((a_found==true)&&(b_found==true)){
printf("%lld",(long long int)a*b);
}
else{
printf("0");
}
return 0;
}
Submission Info
Submission Time
2019-01-20 14:19:57+0900
Task
C - Make a Rectangle
User
vjudge3
Language
C++14 (GCC 5.4.1)
Score
300
Code Size
778 Byte
Status
AC
Exec Time
18 ms
Memory
640 KB
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:12:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&N);
^
./Main.cpp:15:29: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&arra[i]);
^
Judge Result
Set Name
Sample
All
Score / Max Score
0 / 0
300 / 300
Status
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
18 ms
640 KB
2.txt
AC
8 ms
384 KB
3.txt
AC
18 ms
640 KB
4.txt
AC
18 ms
640 KB
5.txt
AC
8 ms
384 KB
6.txt
AC
15 ms
640 KB
7.txt
AC
15 ms
640 KB
8.txt
AC
7 ms
384 KB
9.txt
AC
10 ms
384 KB
sample1.txt
AC
1 ms
256 KB
sample2.txt
AC
1 ms
256 KB
sample3.txt
AC
1 ms
256 KB