Submission #1867637


Source Code Expand

#define _CRT_SECURE_NO_WARNINGS
#include <vector>
#include <iostream>
#include <string.h>
#include <set>
#include <algorithm>
#include <cmath>
#include <queue>
using namespace std;

typedef double LD;
typedef long long LL;
typedef pair<int, int> PII;
#define MP make_pair
#define PB push_back
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); --i)
#define REP(i, t) FOR(i,0,t)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())

const LL MOD = 1000000007;
const int INF = 1e9;
const LL LINF = 1LL * INF * INF;
const int MAXN = 2007;
const LD EPS = 1e-7;

int A[MAXN], B[MAXN];

int main()
{
	ios_base::sync_with_stdio(0);
	//freopen("In.txt", "r", stdin);
	int n;
	LL x, ans = LINF;
	cin >> n >> x;
	REP(i, n)
	{
		cin >> A[i];
		B[i] = A[i];
	}
	REP(k, n)
	{
		LL cur = k * x;
		REP(i, n)
			cur += B[i];
		ans = min(ans, cur);
		REP(i, n)
			B[i] = min(B[i], A[(i - k + n) % n]);
	}
	//cout << endl; system("pause");
	return 0;
}

Submission Info

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

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
WA × 3
WA × 21
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 WA 1 ms 256 KB
0_01.txt WA 1 ms 256 KB
0_02.txt WA 1 ms 256 KB
1_00.txt WA 14 ms 256 KB
1_01.txt WA 14 ms 256 KB
1_02.txt WA 14 ms 256 KB
1_03.txt WA 15 ms 256 KB
1_04.txt WA 14 ms 256 KB
1_05.txt WA 14 ms 256 KB
1_06.txt WA 15 ms 256 KB
1_07.txt WA 14 ms 256 KB
1_08.txt WA 14 ms 256 KB
1_09.txt WA 14 ms 256 KB
1_10.txt WA 11 ms 256 KB
1_11.txt WA 14 ms 256 KB
1_12.txt WA 13 ms 256 KB
1_13.txt WA 10 ms 256 KB
1_14.txt WA 14 ms 256 KB
1_15.txt WA 11 ms 256 KB
1_16.txt WA 13 ms 256 KB
1_17.txt WA 14 ms 256 KB