Submission #1838481
Source Code Expand
#include<bits/stdc++.h> #define int long long using namespace std; typedef pair<int,int> P; int n, x, a[2005]; P A[2005], B[2005]; signed main(){ cin>>n>>x; for(int i=0;i<n;i++){ cin>>a[i]; A[i].first=a[i]; A[i].second=a[i]; B[i]=A[i]; } int Ans=(1e15); for(int t=0;t<=n;t++){ for(int i=0;i<n;i++) A[i]=B[i]; int maxX=0; for(int i=0;i<n;i++) for(int j=0;j<t;j++) if(A[(i+j)%n].first>a[i]+j*x){ A[(i+j)%n].first=a[i]+j*x; A[(i+j)%n].second=a[i]; maxX=max(maxX, j*x); }else if(A[(i+j)%n].first==a[i]+j*x) if(A[(i+j)%n].second>a[i]) A[(i+j)%n].second=a[i]; int ans=maxX; for(int i=0;i<n;i++) ans+=A[i].second; Ans=min(Ans, ans); } cout<<Ans<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Colorful Slimes |
User | Gacho_0716 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 832 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 |