CODE FESTIVAL 2016 Final

Submission #994070

Source codeソースコード

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <array>
#include <list>
#include <stack>
#include <valarray>

using namespace std;

typedef unsigned uint;
typedef long long Int;
typedef unsigned long long UInt;

const int INF = 1001001001;
const Int INFLL = 1001001001001001001LL;

template<typename T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<typename T> void chmin(T& a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T& a, T b) { if (a < b) a = b; }
int in() { int x; scanf("%d", &x); return x; }
double fin() { double x; scanf("%lf", &x); return x; }
Int lin() { Int x; scanf("%lld", &x); return x; }

int A[100050];
int S[100050], dp[100050], ma[100050];

int main() {
  int N = in();
  for (int i = 0; i < N - 1; ++i) {
    S[i] = A[i] = in();
    if (i > 0) {
      S[i] += S[i - 1];
    }
  }
  int M = in();
  if (M > 1) {
    return 0;
  }

  A[N - 1] = in();
  S[N - 1] = A[N - 1] + S[N - 2];
  dp[N - 1] = 0;
  ma[N - 1] = A[N - 1] - S[N - 2];
  for (int i = N - 2; i >= 1; --i) {
    dp[i] = S[i] + ma[i + 1];
    ma[i] = max(ma[i + 1], A[i] - S[i - 1] - dp[i]);
  }

  printf("%d\n", dp[1] + A[0] - A[1]);

  return 0;
}

Submission

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

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

./Main.cpp: In function ‘int in()’:
./Main.cpp:34:34: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
int in() { int x; scanf("%d", &x); return x; }
^
./Main.cpp: In function ‘double fin()’:
./Main.cpp:35:42: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
double fin() { double x; scanf("%lf", &x); return x; }
^
./Main.cpp: In function ‘Int lin()’:
./Main.cpp:36:37: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
Int lin() { Int x; scanf("%lld", &x); return x; }
^

Test case

Set

Set name Score得点 / Max score Cases
sample - sample-01.txt,sample-02.txt
dataset1 0 / 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

Test case

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