CODE FESTIVAL 2016 Final

Submission #1755191

Source codeソースコード

#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main(){
    int n;
    cin >> n;
    VL a(n);
    REP(i,n-1) scanf("%lld", &a[i]);

    int m;
    cin >> m;

    if (m > 1) return 0;
    cin >> a[n-1];

    VL s(n+1);
    REP(i,n) s[i+1] = s[i] + a[i];

    VL dp(n);
    dp[n-2] = a[n-2] - a[n-1];
    ll mi = dp[n-2] + s[n-2];;
    FORR(i,n-3,0){
        dp[i] = a[i] + s[i+1] - mi;
        mi = min(mi, dp[i] + s[i]);
    }
    cout << dp[0] << endl;

    return 0;
}




Submission

Task問題 H - Tokaido
User nameユーザ名 TangentDay
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 WA
Score得点 700
Source lengthソースコード長 1076 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Compiler messageコンパイルメッセージ

./Main.cpp: In function ‘int main()’:
./Main.cpp:33:36: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
REP(i,n-1) scanf("%lld", &a[i]);
^

Test case

Set

Set name Score得点 / Max score Cases
sample - sample-01.txt,sample-02.txt
dataset1 700 / 700 sample-01.txt,01-01.txt,01-02.txt,01-03.txt,01-04.txt,01-05.txt,01-06.txt,01-07.txt,01-08.txt,01-09.txt,01-10.txt,01-11.txt,01-12.txt,01-13.txt,01-14.txt,01-15.txt,01-16.txt,01-17.txt,01-18.txt,01-19.txt
dataset2 0 / 900 sample-01.txt,sample-02.txt,01-01.txt,01-02.txt,01-03.txt,01-04.txt,01-05.txt,01-06.txt,01-07.txt,01-08.txt,01-09.txt,01-10.txt,01-11.txt,01-12.txt,01-13.txt,01-14.txt,01-15.txt,01-16.txt,01-17.txt,01-18.txt,01-19.txt,02-01.txt,02-02.txt,02-03.txt,02-04.txt,02-05.txt,02-06.txt,02-07.txt,02-08.txt,02-09.txt,02-10.txt,02-11.txt,02-12.txt,02-13.txt,02-14.txt,02-15.txt,02-16.txt,sample-01.txt,sample-02.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
01-01.txt AC 18 ms 4992 KB
01-02.txt AC 1 ms 256 KB
01-03.txt AC 1 ms 256 KB
01-04.txt AC 10 ms 2432 KB
01-05.txt AC 18 ms 4992 KB
01-06.txt AC 18 ms 4992 KB
01-07.txt AC 6 ms 1536 KB
01-08.txt AC 18 ms 4864 KB
01-09.txt AC 18 ms 4992 KB
01-10.txt AC 1 ms 256 KB
01-11.txt AC 5 ms 1152 KB
01-12.txt AC 18 ms 4736 KB
01-13.txt AC 18 ms 4992 KB
01-14.txt AC 18 ms 4864 KB
01-15.txt AC 18 ms 4992 KB
01-16.txt AC 18 ms 4992 KB
01-17.txt AC 18 ms 4992 KB
01-18.txt AC 18 ms 4992 KB
01-19.txt AC 18 ms 4992 KB
02-01.txt WA
02-02.txt WA
02-03.txt WA
02-04.txt WA
02-05.txt WA
02-06.txt WA
02-07.txt WA
02-08.txt WA
02-09.txt WA
02-10.txt WA
02-11.txt WA
02-12.txt WA
02-13.txt WA
02-14.txt WA
02-15.txt WA
02-16.txt WA
sample-01.txt AC 1 ms 256 KB
sample-02.txt WA