Contest Duration: - (local time) (120 minutes) Back to Home

Submission #1033453

Source Code Expand

Copy
```#include <bits/stdc++.h>
#include <tuple>

#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define RREP(i,n) for(int i=(int)(n); i>=0; --i)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);++i)
typedef long long int ll;
using namespace std;

int W, H;
int N;
int X[81], Y[81];

typedef tuple<int, int, int, int> T;
map<T, int> c;

int dp(int i, int j, int w, int h) {
T t = make_tuple(i, j, w, h);
if(c.count(t) == 1) return c[t];
int ret = 0;
REP(k, N) {
int s = X[k]; int t = Y[k];
if(s >= i && s <= w && t >= j && t <= h) {
ret = max(ret, w+h-i-j+1 + dp(i, j, s-1, t-1) + dp(s+1, j, w, t-1)
+ dp(i, t+1, s-1, h) + dp(s+1, t+1, w, h));
}
}
return (c[t] = ret);
}

int main(void) {
cin >> W >> H;
if(W > 80 || H > 80) return 0;
cin >> N;
REP(i, N) cin >> X[i] >> Y[i];
cout << dp(1, 1, W, H) << endl;
}```

#### Submission Info

Submission Time 2016-12-19 14:23:11+0900 D - 金塊ゲーム kivantium C++11 (GCC 4.8.1) 99 951 Byte WA 42 ms 1564 KB

#### Judge Result

Score / Max Score 0 / 0 80 / 80 19 / 19 0 / 1
Status
 AC × 3
 AC × 25
 AC × 50
 AC × 50 WA × 25
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
sample_01.txt AC 17 ms 924 KB
sample_02.txt AC 19 ms 924 KB
sample_03.txt AC 19 ms 796 KB
subtask1_01.txt AC 17 ms 792 KB
subtask1_02.txt AC 18 ms 924 KB
subtask1_03.txt AC 19 ms 800 KB
subtask1_04.txt AC 18 ms 920 KB
subtask1_05.txt AC 18 ms 800 KB
subtask1_06.txt AC 18 ms 916 KB
subtask1_07.txt AC 18 ms 800 KB
subtask1_08.txt AC 18 ms 792 KB
subtask1_09.txt AC 19 ms 920 KB
subtask1_10.txt AC 19 ms 796 KB
subtask1_11.txt AC 18 ms 800 KB
subtask1_12.txt AC 19 ms 920 KB
subtask1_13.txt AC 18 ms 928 KB
subtask1_14.txt AC 19 ms 924 KB
subtask1_15.txt AC 18 ms 928 KB
subtask1_16.txt AC 19 ms 928 KB
subtask1_17.txt AC 19 ms 804 KB
subtask1_18.txt AC 24 ms 728 KB
subtask1_19.txt AC 19 ms 804 KB
subtask1_20.txt AC 18 ms 928 KB
subtask1_21.txt AC 17 ms 928 KB
subtask1_22.txt AC 18 ms 800 KB
subtask1_23.txt AC 19 ms 800 KB
subtask1_24.txt AC 19 ms 796 KB
subtask1_25.txt AC 17 ms 928 KB
subtask2_01.txt AC 20 ms 924 KB
subtask2_02.txt AC 19 ms 920 KB
subtask2_03.txt AC 21 ms 1052 KB
subtask2_04.txt AC 21 ms 1052 KB
subtask2_05.txt AC 26 ms 1100 KB
subtask2_06.txt AC 28 ms 1184 KB
subtask2_07.txt AC 29 ms 1192 KB
subtask2_08.txt AC 30 ms 1140 KB
subtask2_09.txt AC 40 ms 1396 KB
subtask2_10.txt AC 40 ms 1392 KB
subtask2_11.txt AC 40 ms 1392 KB
subtask2_12.txt AC 39 ms 1396 KB
subtask2_13.txt AC 30 ms 1180 KB
subtask2_14.txt AC 29 ms 1132 KB
subtask2_15.txt AC 19 ms 788 KB
subtask2_16.txt AC 28 ms 1140 KB
subtask2_17.txt AC 39 ms 1396 KB
subtask2_18.txt AC 40 ms 1396 KB
subtask2_19.txt AC 41 ms 1448 KB
subtask2_20.txt AC 40 ms 1388 KB
subtask2_21.txt AC 39 ms 1564 KB
subtask2_22.txt AC 40 ms 1396 KB
subtask2_23.txt AC 40 ms 1440 KB
subtask2_24.txt AC 41 ms 1372 KB
subtask2_25.txt AC 42 ms 1444 KB
subtask3_01.txt WA 18 ms 796 KB
subtask3_02.txt WA 18 ms 796 KB
subtask3_03.txt WA 19 ms 800 KB
subtask3_04.txt WA 18 ms 800 KB
subtask3_05.txt WA 18 ms 796 KB
subtask3_06.txt WA 17 ms 672 KB
subtask3_07.txt WA 18 ms 664 KB
subtask3_08.txt WA 18 ms 796 KB
subtask3_09.txt WA 18 ms 800 KB
subtask3_10.txt WA 17 ms 800 KB
subtask3_11.txt WA 19 ms 800 KB
subtask3_12.txt WA 17 ms 796 KB
subtask3_13.txt WA 18 ms 796 KB
subtask3_14.txt WA 17 ms 800 KB
subtask3_15.txt WA 19 ms 800 KB
subtask3_16.txt WA 18 ms 912 KB
subtask3_17.txt WA 19 ms 800 KB
subtask3_18.txt WA 19 ms 796 KB
subtask3_19.txt WA 19 ms 796 KB
subtask3_20.txt WA 19 ms 668 KB
subtask3_21.txt WA 18 ms 800 KB
subtask3_22.txt WA 18 ms 672 KB
subtask3_23.txt WA 19 ms 800 KB
subtask3_24.txt WA 19 ms 792 KB
subtask3_25.txt WA 17 ms 800 KB