結果

問題 No.489 株に挑戦
ユーザー nanophoto12nanophoto12
提出日時 2020-07-25 16:44:40
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,382 bytes
コンパイル時間 1,973 ms
コンパイル使用メモリ 205,580 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-09 16:10:06
合計ジャッジ時間 4,892 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
4,376 KB
testcase_01 WA -
testcase_02 AC 2 ms
4,380 KB
testcase_03 WA -
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 WA -
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 3 ms
4,380 KB
testcase_16 AC 22 ms
4,376 KB
testcase_17 AC 4 ms
4,376 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 27 ms
4,380 KB
testcase_21 AC 8 ms
4,380 KB
testcase_22 AC 3 ms
4,376 KB
testcase_23 AC 17 ms
4,376 KB
testcase_24 AC 32 ms
4,384 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 28 ms
4,380 KB
testcase_27 AC 29 ms
4,376 KB
testcase_28 AC 1 ms
4,376 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 31 ms
4,376 KB
testcase_31 AC 29 ms
4,376 KB
testcase_32 AC 18 ms
4,380 KB
testcase_33 AC 30 ms
4,376 KB
testcase_34 AC 26 ms
4,376 KB
testcase_35 AC 11 ms
4,380 KB
testcase_36 AC 5 ms
4,376 KB
testcase_37 AC 17 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0