Submission #1690952
Source Code Expand
#include<cstdio> #include<algorithm> #include<cstring> #include<cmath> using namespace std; typedef long long ll; const int maxn=2100; int a[maxn], n, x; int Next(int x){ return (x)%n+1; } ll ans; int main(){ scanf("%d%d",&n,&x); for(int i=1;i<=n;i++) scanf("%d",&a[i]); int Min=1; for(int i=2;i<=n;i++) if(a[Min]>a[i]) Min=i; int now=Min; for(int i=1;i<=n;i++){ int tmp=min(a[Min]+x,a[now]); now=Next(now); ans+=tmp; //printf("now=%d\n",now); //printf("%d\n",tmp); if(a[Min]+x>a[now]) Min=now; } printf("%lld",ans); return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Colorful Slimes |
User | ljs |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 588 Byte |
Status | WA |
Exec Time | 1 ms |
Memory | 128 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:19:21: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d%d",&n,&x); ^ ./Main.cpp:20:41: 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("%d",&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 | 0 ms | 128 KB |
0_01.txt | AC | 0 ms | 128 KB |
0_02.txt | AC | 1 ms | 128 KB |
1_00.txt | AC | 1 ms | 128 KB |
1_01.txt | AC | 1 ms | 128 KB |
1_02.txt | AC | 1 ms | 128 KB |
1_03.txt | AC | 1 ms | 128 KB |
1_04.txt | AC | 1 ms | 128 KB |
1_05.txt | AC | 1 ms | 128 KB |
1_06.txt | WA | 1 ms | 128 KB |
1_07.txt | AC | 1 ms | 128 KB |
1_08.txt | WA | 1 ms | 128 KB |
1_09.txt | AC | 1 ms | 128 KB |
1_10.txt | AC | 1 ms | 128 KB |
1_11.txt | WA | 1 ms | 128 KB |
1_12.txt | WA | 1 ms | 128 KB |
1_13.txt | WA | 1 ms | 128 KB |
1_14.txt | WA | 1 ms | 128 KB |
1_15.txt | WA | 1 ms | 128 KB |
1_16.txt | WA | 1 ms | 128 KB |
1_17.txt | WA | 1 ms | 128 KB |