#include <bits/stdc++.h>
#define int long long
//#define double long double
#define Nanase_Kurumi_aka_menhera_chan_is_mine ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define pi pair<int, int>
#define ALL(i) i.begin(),i.end()
#define gcd(i,j) __gcd(i,j)
#define fi first
#define se second
#define eps 0.00000001
#define ist insert
#define DNE nullptr
//#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
//#pragma GCC optimize("O2")
int max(int x,int y){return x>=y?x:y;}
int min(int x,int y){return x>=y?y:x;}
using namespace std;
typedef int ll;
const int N=100005;
const int M=1000005;
const int MOD=1000000007;//998244353;
const int INF=1000000000000000000;//2147483647;
int n,m,k,A,B,C,T;
int s[N],has[N];
int calc(int x,int y){
int cnt=0,j=1,k=1;
vector<int> tim(n+5,0),semi(m+2);
for (int i=0;i<m;i++) semi[i]=s[i];
semi[m]=x;semi[m+1]=y;
sort(ALL(semi));
for (int i=2;i<=n;i++){
tim[i]=tim[i-1]+A;
if (s[j]==i)
tim[i]=min(tim[i],tim[s[j-1]]+(i-s[j-1])*B),j++;
if (semi[k]==i)
tim[i]=min(tim[i],tim[semi[k-1]]+(i-semi[k-1])*C),k++;
}
for (int i=1;i<=n;i++)
if (tim[i]<=T)
cnt++;
return cnt;
}
inline void sol(){
cin >>n>>m>>k>>A>>B>>C>>T;
for (int i=0;i<m;i++)
cin >>s[i],has[s[i]]=1;
int ans=0;
for (int i=1;i<=n;i++){
if (has[i]) continue;
for (int j=i+1;j<=n;j++)
if (!has[j])
ans=max(ans,calc(i,j));
}
cout <<ans-1<<'\n';
}
signed main(){
Nanase_Kurumi_aka_menhera_chan_is_mine
int _=1;
//cin >>_;
while (_--) sol();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
52 ms |
204 KB |
Output is correct |
2 |
Correct |
64 ms |
204 KB |
Output is correct |
3 |
Correct |
67 ms |
204 KB |
Output is correct |
4 |
Correct |
60 ms |
304 KB |
Output is correct |
5 |
Correct |
63 ms |
204 KB |
Output is correct |
6 |
Correct |
52 ms |
304 KB |
Output is correct |
7 |
Correct |
53 ms |
304 KB |
Output is correct |
8 |
Correct |
53 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
52 ms |
204 KB |
Output is correct |
2 |
Correct |
64 ms |
204 KB |
Output is correct |
3 |
Correct |
67 ms |
204 KB |
Output is correct |
4 |
Correct |
60 ms |
304 KB |
Output is correct |
5 |
Correct |
63 ms |
204 KB |
Output is correct |
6 |
Correct |
52 ms |
304 KB |
Output is correct |
7 |
Correct |
53 ms |
304 KB |
Output is correct |
8 |
Correct |
53 ms |
204 KB |
Output is correct |
9 |
Correct |
57 ms |
316 KB |
Output is correct |
10 |
Correct |
73 ms |
304 KB |
Output is correct |
11 |
Incorrect |
56 ms |
204 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
52 ms |
204 KB |
Output is correct |
2 |
Correct |
64 ms |
204 KB |
Output is correct |
3 |
Correct |
67 ms |
204 KB |
Output is correct |
4 |
Correct |
60 ms |
304 KB |
Output is correct |
5 |
Correct |
63 ms |
204 KB |
Output is correct |
6 |
Correct |
52 ms |
304 KB |
Output is correct |
7 |
Correct |
53 ms |
304 KB |
Output is correct |
8 |
Correct |
53 ms |
204 KB |
Output is correct |
9 |
Correct |
57 ms |
316 KB |
Output is correct |
10 |
Correct |
73 ms |
304 KB |
Output is correct |
11 |
Incorrect |
56 ms |
204 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |