Submission #1867640
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] = INF; } REP(k, n) { REP(i, n) B[i] = min(B[i], A[(i - k + n) % n]); LL cur = k * x; REP(i, n) cur += B[i]; ans = min(ans, cur); } cout << ans; //cout << endl; system("pause"); return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Colorful Slimes |
User | vjudge3 |
Language | C++14 (GCC 5.4.1) |
Score | 400 |
Code Size | 1010 Byte |
Status | AC |
Exec Time | 18 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 400 / 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 | 1 ms | 256 KB |
0_01.txt | AC | 1 ms | 256 KB |
0_02.txt | AC | 1 ms | 256 KB |
1_00.txt | AC | 17 ms | 256 KB |
1_01.txt | AC | 17 ms | 256 KB |
1_02.txt | AC | 17 ms | 256 KB |
1_03.txt | AC | 17 ms | 256 KB |
1_04.txt | AC | 18 ms | 256 KB |
1_05.txt | AC | 18 ms | 256 KB |
1_06.txt | AC | 17 ms | 256 KB |
1_07.txt | AC | 17 ms | 256 KB |
1_08.txt | AC | 17 ms | 256 KB |
1_09.txt | AC | 17 ms | 256 KB |
1_10.txt | AC | 13 ms | 256 KB |
1_11.txt | AC | 16 ms | 256 KB |
1_12.txt | AC | 16 ms | 256 KB |
1_13.txt | AC | 11 ms | 256 KB |
1_14.txt | AC | 17 ms | 256 KB |
1_15.txt | AC | 13 ms | 256 KB |
1_16.txt | AC | 15 ms | 256 KB |
1_17.txt | AC | 16 ms | 256 KB |