Submission #1780823


Source Code Expand

#include <cstdio>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <utility>
#include <string>

using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;

const int iinf = 1 << 29;
const long long linf = 1ll << 61;

#define modp(x, y) (((y) + (x) % (y)) % (y))

int N;
int A[100000];

int main(int argc, char* argv[])
{
	scanf("%d", &N);
	for(int i = 0; i < N; i++) scanf("%d", &A[i]);
	sort(A, A + N);

	int w = 0, h = 0;
	for(int i = N - 1; i > 0; i--)
	{
		if(A[i] == A[i - 1] && w == 0)
		{
			w = A[i];
			i--;
		}
		else if(A[i] == A[i - 1] && w != 0)
		{
			h = A[i];
			break;
		}
	}
	printf("%lld\n", (ll)w * (ll)h);

	return 0;
}

Submission Info

Submission Time
Task C - Make a Rectangle
User neiteng
Language C++14 (GCC 5.4.1)
Score 300
Code Size 913 Byte
Status AC
Exec Time 18 ms
Memory 512 KB

Compile Error

./Main.cpp: In function ‘int main(int, char**)’:
./Main.cpp:32:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &N);
                 ^
./Main.cpp:33:47: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  for(int i = 0; i < N; i++) scanf("%d", &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 18 ms 512 KB
2.txt AC 7 ms 384 KB
3.txt AC 18 ms 512 KB
4.txt AC 18 ms 512 KB
5.txt AC 7 ms 384 KB
6.txt AC 14 ms 512 KB
7.txt AC 14 ms 512 KB
8.txt AC 6 ms 384 KB
9.txt AC 9 ms 384 KB
sample1.txt AC 1 ms 128 KB
sample2.txt AC 1 ms 128 KB
sample3.txt AC 1 ms 128 KB