Submission #1691661
Source Code Expand
#include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #include <memory> #include <new> #include <numeric> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <streambuf> #include <string> #include <typeinfo> #include <utility> #include <valarray> #include <vector> #define REP(i, m, n) for(int i=int(m);i<int(n);i++) #define EACH(i, c) for (auto &(i): c) #define all(c) begin(c),end(c) #define EXIST(s, e) ((s).find(e)!=(s).end()) #define SORT(c) sort(begin(c),end(c)) #define pb emplace_back #define MP make_pair #define SZ(a) int((a).size()) //#define LOCAL 0 //#ifdef LOCAL //#define DEBUG(s) cout << (s) << endl //#define dump(x) cerr << #x << " = " << (x) << endl //#define BR cout << endl; //#else //#define DEBUG(s) do{}while(0) //#define dump(x) do{}while(0) //#define BR //#endif //改造 typedef long long int ll; using namespace std; #define INF (int)1e9+1 #define INFl (ll)5e15 #define DEBUG 0 //デバッグする時1にしてね //ここから編集する int N,x; vector<int> a; //n回魔法使ったときの時間 ll calc(int n){ vector<int> b(N,INF); for(int i = 0; i < N; i++){ for(int j = n; j >= 0; j--){ b[i] = min(a[(i - j + N) % N],b[i]); } } return accumulate(b.begin(),b.end(),0LL) + n * x; } int main() { cin >> N >> x; a = vector<int>(N); REP(i,0,N) cin >> a[i]; ll cost = calc(0); REP(i,1,N){ cost = min(cost,calc(i)); } cout << cost << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Colorful Slimes |
User | homesentinel |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1889 Byte |
Status | TLE |
Exec Time | 2103 ms |
Memory | 256 KB |
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 | 1 ms | 256 KB |
0_01.txt | AC | 1 ms | 256 KB |
0_02.txt | AC | 1 ms | 256 KB |
1_00.txt | TLE | 2103 ms | 256 KB |
1_01.txt | TLE | 2103 ms | 256 KB |
1_02.txt | TLE | 2103 ms | 256 KB |
1_03.txt | TLE | 2103 ms | 256 KB |
1_04.txt | TLE | 2103 ms | 256 KB |
1_05.txt | TLE | 2103 ms | 256 KB |
1_06.txt | TLE | 2103 ms | 256 KB |
1_07.txt | TLE | 2103 ms | 256 KB |
1_08.txt | TLE | 2103 ms | 256 KB |
1_09.txt | TLE | 2103 ms | 256 KB |
1_10.txt | TLE | 2103 ms | 256 KB |
1_11.txt | TLE | 2103 ms | 256 KB |
1_12.txt | TLE | 2103 ms | 256 KB |
1_13.txt | TLE | 2103 ms | 256 KB |
1_14.txt | TLE | 2103 ms | 256 KB |
1_15.txt | TLE | 2103 ms | 256 KB |
1_16.txt | TLE | 2103 ms | 256 KB |
1_17.txt | TLE | 2103 ms | 256 KB |