AtCoder Beginner Contest 008

Submission #1588888

Source codeソースコード

#include <bits/stdc++.h>
#define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) for(ll i=1;i<=(n);i++)
#define MOD 1000000007
#define int long long
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<int> vec;
typedef vector<vec> mat;
const int INF = 1e9;

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

map<tuple<int, int, int, int>, int> dp;

int rec(int x1, int y1, int x2, int y2)
{
    if (dp.find(make_tuple(x1, y1, x2, y2)) != dp.end()) return dp[make_tuple(x1, y1, x2, y2)];

    int res = 0;
    REP(i,N) {
        if (x1 <= X[i] && X[i] <= x2 && y1 <= Y[i] && Y[i] <= y2) {
            res = max(res, (x2-x1+y2-y1+1) + rec(x1,y1,X[i]-1,Y[i]-1) + rec(X[i]+1,y1,x2,Y[i]-1) + rec(x1,Y[i]+1,X[i]-1,y2) + rec(X[i]+1,Y[i]+1,x2,y2));
        }
    }
    return dp[make_tuple(x1, y1, x2, y2)] = res;
}

signed main()
{
    cin >> W >> H;
    cin >> N;
    REP(i,N) {
        cin >> X[i] >> Y[i];
    }

    cout << rec(1, 1, W, H) << endl;
}

Submission

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

Test case

Set

Set name Score得点 / Max score Cases
Sample - sample_01.txt,sample_02.txt
All 0 / 100 sample_01.txt,sample_02.txt,case_01.txt,case_02.txt,case_03.txt,case_04.txt,case_05.txt,case_06.txt,case_07.txt,case_08.txt,case_09.txt,case_10.txt,case_11.txt,case_12.txt,case_13.txt,case_14.txt,case_15.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
case_01.txt WA
case_02.txt WA
case_03.txt WA
case_04.txt WA
case_05.txt WA
case_06.txt WA
case_07.txt WA
case_08.txt WA
case_09.txt WA
case_10.txt WA
case_11.txt WA
case_12.txt WA
case_13.txt WA
case_14.txt WA
case_15.txt WA
sample_01.txt WA
sample_02.txt WA