#include <iostream>
#include <vector>
using namespace std;
bool Contains(const vector<long long> &v, long long x){
for (long long el:v){
if (el==x) return true;
}
return false;
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long n, m, kval, a, b, c, t;
cin>>n>>m>>kval>>a>>b>>c>>t;
vector<long long> vect(m);
for (long long i=0;i<m;i++) cin>>vect[i];
long long best=0;
for (long long i=t/a;i<=n;i++){
if (Contains(vect, i)) continue;
long long ubi;
for (long long j=0;j<vect.size();j++){
if (vect[j]>i){
ubi=j;
break;
}
}
for (long long j=i+1;j<=n;j++){
if (i==j||Contains(vect, j)) continue;
long long ubj;
for (long long k=0;k<vect.size();k++){
if (vect[k]>j){
ubj=k;
break;
}
}
long long expstop=0, current=0;
for (long long k=2;k<=n;k++){
if (Contains(vect, k)) expstop++;
long long time=(vect[expstop]-1)*b;
if (expstop==ubj-1&&k>=j){
time+=(j-vect[ubj-1])*c+(k-j)*a;
}
else if (expstop==ubi-1&&k>=i){
time+=(i-vect[ubi-1])*c+(k-i)*a;
}
else time+=(k-vect[expstop])*a;
if (time<=t) current++;
}
if (best<current) best=current;
}
}
cout<<best<<'\n';
return 0;
}
Compilation message
semiexpress.cpp: In function 'int main()':
semiexpress.cpp:24:29: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
24 | for (long long j=0;j<vect.size();j++){
| ~^~~~~~~~~~~~
semiexpress.cpp:33:33: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
33 | for (long long k=0;k<vect.size();k++){
| ~^~~~~~~~~~~~
semiexpress.cpp:32:23: warning: 'ubj' may be used uninitialized in this function [-Wmaybe-uninitialized]
32 | long long ubj;
| ^~~
semiexpress.cpp:23:19: warning: 'ubi' may be used uninitialized in this function [-Wmaybe-uninitialized]
23 | long long ubi;
| ^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |