Submission #866212
Source Code Expand
#include<stdio.h>
#include<algorithm>
using namespace std;
typedef long long LL;
LL a[2005];
int c[2005];
int main()
{
int i,t=0;
LL n,p,x,S=0,m=1e18,l=0;
scanf("%lld %lld", &n, &p);
for(i=1;i<=n;i++){
scanf("%lld", &a[i]);
S+=a[i];
m=min(m,a[i]);
}
for(i=1;i<=n;i++){
if(a[i]==m)c[t++]=i;
}
for(i=1;i<t;i++){
l=max(l,a[i]-a[i-1]);
}
l=max(l,a[0]-a[t-1]+n);
printf("%lld\n", min(S,m*n+p*(l-1)));
return 0;
}
Submission Info
Submission Time |
|
Task |
B - Colorful Slimes |
User |
william202 |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
526 Byte |
Status |
WA |
Exec Time |
3 ms |
Memory |
128 KB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:13:31: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld %lld", &n, &p);
^
./Main.cpp:15:29: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld", &a[i]);
^
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
0 / 400 |
Status |
|
|
Set Name |
Test Cases |
Sample |
0_00.txt, 0_01.txt, 0_02.txt |
All |
0_00.txt, 0_01.txt, 0_02.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt, 1_13.txt, 1_14.txt, 1_15.txt, 1_16.txt, 1_17.txt |
Case Name |
Status |
Exec Time |
Memory |
0_00.txt |
AC |
2 ms |
128 KB |
0_01.txt |
AC |
2 ms |
128 KB |
0_02.txt |
AC |
2 ms |
128 KB |
1_00.txt |
AC |
2 ms |
128 KB |
1_01.txt |
AC |
2 ms |
128 KB |
1_02.txt |
AC |
3 ms |
128 KB |
1_03.txt |
AC |
2 ms |
128 KB |
1_04.txt |
AC |
3 ms |
128 KB |
1_05.txt |
AC |
3 ms |
128 KB |
1_06.txt |
WA |
3 ms |
128 KB |
1_07.txt |
AC |
3 ms |
128 KB |
1_08.txt |
WA |
3 ms |
128 KB |
1_09.txt |
AC |
3 ms |
128 KB |
1_10.txt |
AC |
2 ms |
128 KB |
1_11.txt |
WA |
3 ms |
128 KB |
1_12.txt |
WA |
3 ms |
128 KB |
1_13.txt |
WA |
2 ms |
128 KB |
1_14.txt |
WA |
2 ms |
128 KB |
1_15.txt |
WA |
2 ms |
128 KB |
1_16.txt |
WA |
2 ms |
128 KB |
1_17.txt |
WA |
2 ms |
128 KB |