結果

問題 No.1090 ソーシャルディスタンス / Social Distance
ユーザー kotatsugamekotatsugame
提出日時 2020-06-24 07:07:54
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 147 ms / 2,000 ms
コード長 240 bytes
コンパイル時間 455 ms
コンパイル使用メモリ 62,832 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-16 20:46:57
合計ジャッジ時間 4,460 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 101 ms
4,380 KB
testcase_03 AC 16 ms
4,376 KB
testcase_04 AC 110 ms
4,500 KB
testcase_05 AC 11 ms
4,380 KB
testcase_06 AC 135 ms
4,376 KB
testcase_07 AC 67 ms
4,380 KB
testcase_08 AC 137 ms
4,376 KB
testcase_09 AC 71 ms
4,376 KB
testcase_10 AC 89 ms
4,376 KB
testcase_11 AC 143 ms
4,376 KB
testcase_12 AC 76 ms
4,376 KB
testcase_13 AC 74 ms
4,380 KB
testcase_14 AC 132 ms
4,376 KB
testcase_15 AC 105 ms
4,376 KB
testcase_16 AC 44 ms
4,376 KB
testcase_17 AC 5 ms
4,376 KB
testcase_18 AC 49 ms
4,376 KB
testcase_19 AC 65 ms
4,376 KB
testcase_20 AC 57 ms
4,380 KB
testcase_21 AC 75 ms
4,376 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 147 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:4:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    4 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
int N,D;
main()
{
    cin>>N>>D;
    cout<<0;
    int S=0,P=0;
    for(int i=1;i<N;i++)
    {
        int A;cin>>A;
        S+=A;
        if(P+D<S)P=S;
        else P+=D;
        cout<<" "<<P;
    }
}
0