結果

問題 No.489 株に挑戦
ユーザー mamekinmamekin
提出日時 2017-04-02 04:27:05
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,055 bytes
コンパイル時間 1,000 ms
コンパイル使用メモリ 107,400 KB
実行使用メモリ 8,160 KB
最終ジャッジ日時 2023-09-22 03:25:26
合計ジャッジ時間 3,667 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 4 ms
4,380 KB
testcase_16 AC 57 ms
5,272 KB
testcase_17 AC 5 ms
4,380 KB
testcase_18 AC 27 ms
4,376 KB
testcase_19 AC 24 ms
4,436 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 1 ms
4,376 KB
testcase_26 AC 51 ms
7,564 KB
testcase_27 AC 39 ms
4,376 KB
testcase_28 WA -
testcase_29 AC 1 ms
4,380 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:52:29: 警告: ‘b’ may be used uninitialized [-Wmaybe-uninitialized]
   52 |         cout << a << ' ' << b << endl;
      |                             ^
main.cpp:35:12: 備考: ‘b’ はここで定義されています
   35 |     int a, b;
      |            ^
main.cpp:52:22: 警告: ‘a’ may be used uninitialized [-Wmaybe-uninitialized]
   52 |         cout << a << ' ' << b << endl;
      |                      ^~~
main.cpp:35:9: 備考: ‘a’ はここで定義されています
   35 |     int a, b;
      |         ^

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

int main()
{
    int n, d, k;
    cin >> n >> d >> k;
    vector<int> x(n);
    for(int i=0; i<n; ++i)
        cin >> x[i];

    int ans = 0;
    int a, b;
    multiset<pair<int, int> > ms;
    for(int i=0; i<n; ++i){
        ms.insert(make_pair(x[i], i));
        pair<int, int> p = *ms.begin();
        if(ans < x[i] - p.first){
            ans = x[i] - p.first;
            a = p.second;
            b = i;
        }
        if(i-d >= 0)
            ms.erase(make_pair(x[i-d], i-d));
    }

    ans *= k;
    cout << ans << endl;
    if(ans > 0)
        cout << a << ' ' << b << endl;

    return 0;
}
0