Submission #6613313


Source Code Expand

#include <bits/stdc++.h>
#define N 1001000
#define inf 0x3f3f3f3f
#define LL long long
#define pi acos(-1)
#define MOD 1000000007
using namespace std;

LL a[N];
int n;

int main()
{
	//freopen("dark.in","r",stdin);
	//freopen("dark.out","w",stdout);
	scanf("%d",&n);
	for (int i = 1; i <= n; ++i) scanf("%lld",&a[i]);
	LL m1 = a[1],mi = 1;
	for (int i = 2; i <= n; ++i) if (a[i]>m1) {m1 = a[i];mi = i;}
	LL m2;
	if (mi==1) m2 = a[2];else m2 = a[1];
	for (int i = 1; i <= n; ++i) if (mi!=i) m2 = max(m2,a[i]);
	for (int i = 1; i <= n; ++i) if (mi==i) printf("%lld\n",m2); else printf("%lld\n",m1);
	return 0;
}

Submission Info

Submission Time
Task C - Exception Handling
User ZzZZCHS
Language C++14 (GCC 5.4.1)
Score 300
Code Size 635 Byte
Status AC
Exec Time 38 ms
Memory 3200 KiB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:16:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
                ^
./Main.cpp:17:50: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  for (int i = 1; i <= n; ++i) scanf("%lld",&a[i]);
                                                  ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 12
Set Name Test Cases
Sample a01, a02
All a01, a02, b03, b04, b05, b06, b07, b08, b09, b10, b11, b12
Case Name Status Exec Time Memory
a01 AC 1 ms 256 KiB
a02 AC 1 ms 256 KiB
b03 AC 1 ms 256 KiB
b04 AC 1 ms 256 KiB
b05 AC 1 ms 256 KiB
b06 AC 38 ms 3200 KiB
b07 AC 31 ms 2176 KiB
b08 AC 37 ms 3200 KiB
b09 AC 37 ms 2944 KiB
b10 AC 38 ms 3200 KiB
b11 AC 38 ms 3200 KiB
b12 AC 37 ms 2944 KiB