Submission #845976


Source Code Expand

#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
#define SZ(a) int((a).size())
#define FOR(var,a,b) for(int var=(a);var<(b);var++)
#define REP(var,n) FOR(var,0,n)
#define INT(n) int n;scanf("%d",&n);
#define AI(a,n) int a[n];REP(i,n){scanf("%d",&a[i]);}
#define MSET(arr,val)  memset(arr,val,sizeof(arr))

int main(){
  INT(n); AI(as, n);
  LL dp[n];
  dp[0] = 0LL;
  dp[1] = as[0] / 2 + as[1] / 2 + (as[0] % 2) * (as[1] % 2);
  FOR(i, 2, n){
    dp[i] = max(dp[i - 2] + as[i] / 2 + as[i - 1] / 2 + ((as[i - 1] % 2) * (as[i] % 2)), dp[i - 1] + as[i] / 2);
  }
  printf("%lld\n", dp[n - 1]);
  return 0;
}

Submission Info

Submission Time
Task B - Simplified mahjong
User Naoki_M_
Language C++14 (GCC 5.4.1)
Score 0
Code Size 647 Byte
Status WA
Exec Time 28 ms
Memory 1408 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:8:36: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
 #define INT(n) int n;scanf("%d",&n);
                                    ^
./Main.cpp:13:3: note: in expansion of macro ‘INT’
   INT(n); AI(as, n);
   ^
./Main.cpp:9:52: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
 #define AI(a,n) int a[n];REP(i,n){scanf("%d",&a[i]);}
                                                    ^
./Main.cpp:13:11: note: in expansion of macro ‘AI’
   INT(n); AI(as, n);
           ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 2
AC × 11
WA × 13
Set Name Test Cases
Sample s1.txt, s2.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, s1.txt, s2.txt
Case Name Status Exec Time Memory
01.txt WA 27 ms 1408 KB
02.txt WA 27 ms 1408 KB
03.txt WA 27 ms 1408 KB
04.txt WA 24 ms 1408 KB
05.txt WA 24 ms 1408 KB
06.txt WA 24 ms 1408 KB
07.txt WA 26 ms 1408 KB
08.txt WA 26 ms 1408 KB
09.txt WA 27 ms 1408 KB
10.txt WA 27 ms 1408 KB
11.txt AC 18 ms 1408 KB
12.txt AC 28 ms 1408 KB
13.txt AC 27 ms 1408 KB
14.txt AC 27 ms 1408 KB
15.txt AC 19 ms 1408 KB
16.txt WA 27 ms 1408 KB
17.txt WA 27 ms 1408 KB
18.txt AC 4 ms 256 KB
19.txt AC 4 ms 256 KB
20.txt WA 4 ms 256 KB
21.txt AC 4 ms 256 KB
22.txt AC 4 ms 256 KB
s1.txt AC 4 ms 256 KB
s2.txt AC 4 ms 256 KB