結果
| 問題 |
No.489 株に挑戦
|
| コンテスト | |
| ユーザー |
nanophoto12
|
| 提出日時 | 2020-07-25 16:44:40 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,382 bytes |
| コンパイル時間 | 2,907 ms |
| コンパイル使用メモリ | 198,028 KB |
| 最終ジャッジ日時 | 2025-01-12 05:32:05 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 31 WA * 4 |
ソースコード
#include <bits/stdc++.h>
#define M_PI 3.14159265358979323846 // pi
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;
typedef tuple<ll, ll, ll, ll, ll> t5;
#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)
using namespace std;
static const ll INF = 1e15;
const ll mod = 1000000007;
template<typename T>
static inline void chmin(T & ref, const T value) {
if (ref > value) ref = value;
}
template<typename T>
static inline void chmax(T& ref, const T value) {
if (ref < value) ref = value;
}
int main() {
ll n, day, k;
cin >> n >> day >> k;
vector<ll> vs(n);
rep(i, n) cin >> vs[i];
deque<int> deq;
rep(i, day+1) {
while (!deq.empty() && vs[deq.front()] <= vs[i]) {
deq.pop_front();
}
deq.push_back(i);
}
ll up = 0;
ll o1 = 0, o2 = 0;
for (int i = 0; i < n; i++) {
auto o = vs[i];
auto t = vs[deq.front()];
if (up < t - o) {
o1 = i;
o2 = deq.front();
up = t - o;
}
if (deq.front() == i) {
deq.pop_front();
}
if (i + day + 1 < n) {
while (!deq.empty() && vs[deq.front()] <= vs[i+day + 1]) {
deq.pop_front();
}
deq.push_back(i + day + 1);
}
}
cout << up * k << endl;
if (up > 0) {
cout << o1 << " " << o2 << endl;
}
return 0;
}
nanophoto12