Submission #865605


Source Code Expand

#define _CRT_SECURE_NO_WARNINGS
#include<sstream>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())





int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int a[2000];
	int n,x;
	cin >> n >> x;
	rep(i, n)cin >> a[i];
	rep(k, 2) {
		rep(i, n) {
			a[i] = min(a[i], a[(i - 1 + n) % n] + x);
		}
	}
	long long ans = 0;
	rep(i, n)ans += a[i];

	cout << ans << endl;
	return 0;
}

Submission Info

Submission Time
Task B - Colorful Slimes
User hirokazu1020
Language C++14 (GCC 5.4.1)
Score 0
Code Size 858 Byte
Status WA
Exec Time 5 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 2
WA × 1
AC × 9
WA × 12
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 4 ms 256 KB
0_01.txt WA 4 ms 256 KB
0_02.txt AC 4 ms 256 KB
1_00.txt AC 4 ms 256 KB
1_01.txt AC 4 ms 256 KB
1_02.txt AC 5 ms 256 KB
1_03.txt AC 5 ms 256 KB
1_04.txt WA 5 ms 256 KB
1_05.txt AC 5 ms 256 KB
1_06.txt WA 5 ms 256 KB
1_07.txt AC 5 ms 256 KB
1_08.txt WA 5 ms 256 KB
1_09.txt AC 5 ms 256 KB
1_10.txt WA 5 ms 256 KB
1_11.txt WA 5 ms 256 KB
1_12.txt WA 4 ms 256 KB
1_13.txt WA 5 ms 256 KB
1_14.txt WA 5 ms 256 KB
1_15.txt WA 4 ms 256 KB
1_16.txt WA 5 ms 256 KB
1_17.txt WA 4 ms 256 KB