#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int INF = (int) 1e9 + 1e6;
const ll LINF = (ll) 1e18 + 1e9;
const ll MOD = (ll) 1e9 + 7;
#define sz(x) (int) (x).size()
#define mp(x, y) make_pair(x, y)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lb(s, t, x) (int) (lower_bound(s, t, x) - s)
#define ub(s, t, x) (int) (upper_bound(s, t, x) - s)
#define rep(i, f, t) for (auto i = f; i < t; ++(i))
#define per(i, f, t) for (auto i = (f); i >= (t); --(i))
ll power(ll x, ll y, ll mod = MOD) {
if (y == 0) {
return 1;
}
if (y & 1) {
return power(x, y - 1, mod) * x % mod;
} else {
ll tmp = power(x, y / 2, mod);
return tmp * tmp % mod;
}
}
template<typename A, typename B> bool mini(A &x, const B &y) {
if (y < x) {
x = y;
return true;
}
return false;
}
template<typename A, typename B> bool maxi(A &x, const B &y) {
if (x < y) {
x = y;
return true;
}
return false;
}
void add(ll &x, ll y) {
x += y;
if (x >= MOD) x -= MOD;
if (x < 0) x += MOD;
}
void run();
#define TASK ""
int main() {
#ifdef LOCAL
if (strlen(TASK) > 0) {
cerr << "Reminder: you are using file i/o, filename: " TASK "!" << endl << endl;
}
#endif
#ifndef LOCAL
if (strlen(TASK)) {
freopen(TASK ".in", "r", stdin);
freopen(TASK ".out", "w", stdout);
}
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
#endif
cout << fixed << setprecision(12);
run();
return 0;
}
// == SOLUTION == //
const int N = (int) 2e5 + 123;
int x, n, m, w, t;
int s[N];
pair<int, int> p[N];
int d[N], c[N];
int r[N];
vector<int> what[N];
ll dp[N];
void run() {
cin >> x >> n >> m >> w >> t;
rep(i, 1, n + 1) {
cin >> s[i];
}
s[n + 1] = x;
rep(i, 1, m + 1) {
cin >> p[i].first >> p[i].second;
}
sort(p + 1, p + m + 1);
rep(i, 1, m + 1) {
d[i] = p[i].first;
c[i] = p[i].second;
}
rep(i, 0, m) {
assert(d[i] < d[i + 1]);
}
rep(i, 0, n + 1) {
//~ r[i] = (int) (lower_bound(d, d + m + 1, s[i + 1] % t) - d) - 1;
//~ what[r[i]].pb(i);
}
/*dp[0] = s[n + 1] / t * w + w;
rep(i, 1, m + 1) {
dp[i] = dp[i - 1] + (s[n + 1] - d[i]) / t * w + w;
for (int id : what[i]) {
ll cnt = s[id + 1] / t;
ll fee = 0;
per(j, i, 1) {
fee += c[j];
mini(dp[i], dp[j - 1] + fee + (i - j + 1) * cnt * w);
}
}
}*/
cout << dp[m] << "\n";
}
Compilation message
coach.cpp: In function 'int main()':
coach.cpp:67:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
freopen(TASK ".in", "r", stdin);
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
coach.cpp:68:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
freopen(TASK ".out", "w", stdout);
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
5112 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
5112 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
5112 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
5112 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |