#include <iostream>
#include <vector>
using namespace std;
bool Contains(const vector<int> &v, int x){
for (int el:v){
if (el==x) return true;
}
return false;
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, m, kval, a, b, c, t;
cin>>n>>m>>kval>>a>>b>>c>>t;
vector<int> vect(m);
for (int i=0;i<m;i++) cin>>vect[i];
int best=0;
for (int i=t/a;i<=n;i++){
if (Contains(vect, i)) continue;
int ubi;
for (int j=0;j<vect.size();j++){
if (vect[j]>i){
ubi=j;
break;
}
}
for (int j=i+1;j<=n;j++){
if (i==j||Contains(vect, j)) continue;
int ubj;
for (int k=0;k<vect.size();k++){
if (vect[k]>j){
ubj=k;
break;
}
}
int expstop=0, current=0;
for (int k=2;k<=n;k++){
if (Contains(vect, k)) expstop++;
int 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:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
24 | for (int j=0;j<vect.size();j++){
| ~^~~~~~~~~~~~
semiexpress.cpp:33:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
33 | for (int k=0;k<vect.size();k++){
| ~^~~~~~~~~~~~
semiexpress.cpp:32:17: warning: 'ubj' may be used uninitialized in this function [-Wmaybe-uninitialized]
32 | int ubj;
| ^~~
semiexpress.cpp:23:13: warning: 'ubi' may be used uninitialized in this function [-Wmaybe-uninitialized]
23 | int ubi;
| ^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |