Submission #3780068
Source Code Expand
#include <iostream> #include <algorithm> #include <vector> #include <map> #include <set> #include <string> #include <cmath> #include <iomanip> #include <queue> #include <unordered_map> #include <unordered_set> #include <bitset> #include <cassert> #include <cstring> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define REP(i, n) FOR(i, 0, n) #define SORT(c) sort((c).begin(), (c).end()) typedef long long ll; typedef pair<int, int> P; typedef vector<int> V; typedef map<int, int> M; constexpr ll INF = 1e18; constexpr ll MOD = 1e9 + 7; constexpr double PI = 3.14159265358979323846; constexpr int dx[] = {0, 0, 1, -1}; constexpr int dy[] = {1, -1, 0, 0}; int main() { ios::sync_with_stdio(false); cin.tie(0); int N; ll x, a[2123], b[2123]; cin >> N >> x; REP(i, N) { cin >> a[i]; b[i] = a[i]; } ll res = __LONG_LONG_MAX__; for (int i = 0; i < N; i++) { ll tmp = x * i; REP(j, N) { b[j] = min(b[j], a[(j - i + N) % N]); tmp += b[j]; } res = min(res, tmp); } cout << res << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Colorful Slimes |
User | Kats |
Language | C++14 (GCC 5.4.1) |
Score | 400 |
Code Size | 1231 Byte |
Status | AC |
Exec Time | 15 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 | 15 ms | 256 KB |
1_01.txt | AC | 14 ms | 256 KB |
1_02.txt | AC | 15 ms | 256 KB |
1_03.txt | AC | 15 ms | 256 KB |
1_04.txt | AC | 15 ms | 256 KB |
1_05.txt | AC | 15 ms | 256 KB |
1_06.txt | AC | 15 ms | 256 KB |
1_07.txt | AC | 15 ms | 256 KB |
1_08.txt | AC | 15 ms | 256 KB |
1_09.txt | AC | 15 ms | 256 KB |
1_10.txt | AC | 11 ms | 256 KB |
1_11.txt | AC | 14 ms | 256 KB |
1_12.txt | AC | 13 ms | 256 KB |
1_13.txt | AC | 10 ms | 256 KB |
1_14.txt | AC | 14 ms | 256 KB |
1_15.txt | AC | 11 ms | 256 KB |
1_16.txt | AC | 13 ms | 256 KB |
1_17.txt | AC | 14 ms | 256 KB |