Submission #1605173
Source Code Expand
#include <stdio.h> #include <algorithm> #define BUF (100) int N; int A[BUF]; void input(void){ scanf("%d",&N); for(int i=1;i<=N;i++){ scanf("%d",&A[i]); } } int main(void){ input(); std::sort(A+1,A+N+1); int tmp[BUF]; int cnt=0; int i=0; while(1){ i++; if(i>=N)break; if( A[i]==A[i+1] ){ tmp[cnt] = A[i]; i++; cnt++; } } /* for(int j=0;j<cnt;j++){ printf("%d\n",tmp[j]); } */ if(cnt<2){ printf("0\n"); }else{ long ans =(long)tmp[cnt-1]*(long)tmp[cnt-2]; printf("%ld\n",ans); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Make a Rectangle |
User | nmiyamoto |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 597 Byte |
Status | RE |
Exec Time | 98 ms |
Memory | 128 KB |
Compile Error
./Main.cpp: In function ‘void input()’: ./Main.cpp:9:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&N); ^ ./Main.cpp:11:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&A[i]); ^
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 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 | RE | 98 ms | 128 KB |
2.txt | RE | 97 ms | 128 KB |
3.txt | RE | 97 ms | 128 KB |
4.txt | RE | 96 ms | 128 KB |
5.txt | RE | 96 ms | 128 KB |
6.txt | RE | 96 ms | 128 KB |
7.txt | RE | 96 ms | 128 KB |
8.txt | RE | 96 ms | 128 KB |
9.txt | RE | 96 ms | 128 KB |
sample1.txt | AC | 1 ms | 128 KB |
sample2.txt | AC | 1 ms | 128 KB |
sample3.txt | AC | 1 ms | 128 KB |