AtCoder Beginner Contest 008

Submission #1588882

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];

int rec(int x1, int y1, int x2, int 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 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問題 D - 金塊ゲーム
User nameユーザ名 hiyokko3
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 TLE
Score得点 80
Source lengthソースコード長 959 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Test case

Set

Set name Score得点 / Max score Cases
Sample - sample_01.txt,sample_02.txt,sample_03.txt
Subtask1 80 / 80 subtask1_01.txt,subtask1_02.txt,subtask1_03.txt,subtask1_04.txt,subtask1_05.txt,subtask1_06.txt,subtask1_07.txt,subtask1_08.txt,subtask1_09.txt,subtask1_10.txt,subtask1_11.txt,subtask1_12.txt,subtask1_13.txt,subtask1_14.txt,subtask1_15.txt,subtask1_16.txt,subtask1_17.txt,subtask1_18.txt,subtask1_19.txt,subtask1_20.txt,subtask1_21.txt,subtask1_22.txt,subtask1_23.txt,subtask1_24.txt,subtask1_25.txt
Subtask2 0 / 19 subtask1_01.txt,subtask1_02.txt,subtask1_03.txt,subtask1_04.txt,subtask1_05.txt,subtask1_06.txt,subtask1_07.txt,subtask1_08.txt,subtask1_09.txt,subtask1_10.txt,subtask1_11.txt,subtask1_12.txt,subtask1_13.txt,subtask1_14.txt,subtask1_15.txt,subtask1_16.txt,subtask1_17.txt,subtask1_18.txt,subtask1_19.txt,subtask1_20.txt,subtask1_21.txt,subtask1_22.txt,subtask1_23.txt,subtask1_24.txt,subtask1_25.txt,subtask2_01.txt,subtask2_02.txt,subtask2_03.txt,subtask2_04.txt,subtask2_05.txt,subtask2_06.txt,subtask2_07.txt,subtask2_08.txt,subtask2_09.txt,subtask2_10.txt,subtask2_11.txt,subtask2_12.txt,subtask2_13.txt,subtask2_14.txt,subtask2_15.txt,subtask2_16.txt,subtask2_17.txt,subtask2_18.txt,subtask2_19.txt,subtask2_20.txt,subtask2_21.txt,subtask2_22.txt,subtask2_23.txt,subtask2_24.txt,subtask2_25.txt
Subtask3 0 / 1 subtask1_01.txt,subtask1_02.txt,subtask1_03.txt,subtask1_04.txt,subtask1_05.txt,subtask1_06.txt,subtask1_07.txt,subtask1_08.txt,subtask1_09.txt,subtask1_10.txt,subtask1_11.txt,subtask1_12.txt,subtask1_13.txt,subtask1_14.txt,subtask1_15.txt,subtask1_16.txt,subtask1_17.txt,subtask1_18.txt,subtask1_19.txt,subtask1_20.txt,subtask1_21.txt,subtask1_22.txt,subtask1_23.txt,subtask1_24.txt,subtask1_25.txt,subtask2_01.txt,subtask2_02.txt,subtask2_03.txt,subtask2_04.txt,subtask2_05.txt,subtask2_06.txt,subtask2_07.txt,subtask2_08.txt,subtask2_09.txt,subtask2_10.txt,subtask2_11.txt,subtask2_12.txt,subtask2_13.txt,subtask2_14.txt,subtask2_15.txt,subtask2_16.txt,subtask2_17.txt,subtask2_18.txt,subtask2_19.txt,subtask2_20.txt,subtask2_21.txt,subtask2_22.txt,subtask2_23.txt,subtask2_24.txt,subtask2_25.txt,subtask3_01.txt,subtask3_02.txt,subtask3_03.txt,subtask3_04.txt,subtask3_05.txt,subtask3_06.txt,subtask3_07.txt,subtask3_08.txt,subtask3_09.txt,subtask3_10.txt,subtask3_11.txt,subtask3_12.txt,subtask3_13.txt,subtask3_14.txt,subtask3_15.txt,subtask3_16.txt,subtask3_17.txt,subtask3_18.txt,subtask3_19.txt,subtask3_20.txt,subtask3_21.txt,subtask3_22.txt,subtask3_23.txt,subtask3_24.txt,subtask3_25.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
sample_01.txt AC 1 ms 256 KB
sample_02.txt AC 1 ms 256 KB
sample_03.txt AC 1 ms 256 KB
subtask1_01.txt AC 1 ms 256 KB
subtask1_02.txt AC 1 ms 256 KB
subtask1_03.txt AC 1 ms 256 KB
subtask1_04.txt AC 1 ms 256 KB
subtask1_05.txt AC 1 ms 256 KB
subtask1_06.txt AC 1 ms 256 KB
subtask1_07.txt AC 1 ms 256 KB
subtask1_08.txt AC 1 ms 256 KB
subtask1_09.txt AC 1 ms 256 KB
subtask1_10.txt AC 1 ms 256 KB
subtask1_11.txt AC 1 ms 256 KB
subtask1_12.txt AC 1 ms 256 KB
subtask1_13.txt AC 1 ms 256 KB
subtask1_14.txt AC 1 ms 256 KB
subtask1_15.txt AC 1 ms 256 KB
subtask1_16.txt AC 1 ms 256 KB
subtask1_17.txt AC 1 ms 256 KB
subtask1_18.txt AC 1 ms 256 KB
subtask1_19.txt AC 1 ms 256 KB
subtask1_20.txt AC 1 ms 256 KB
subtask1_21.txt AC 1 ms 256 KB
subtask1_22.txt AC 1 ms 256 KB
subtask1_23.txt AC 1 ms 256 KB
subtask1_24.txt AC 1 ms 256 KB
subtask1_25.txt AC 1 ms 256 KB
subtask2_01.txt AC 4 ms 256 KB
subtask2_02.txt AC 4 ms 256 KB
subtask2_03.txt AC 41 ms 256 KB
subtask2_04.txt AC 20 ms 256 KB
subtask2_05.txt AC 295 ms 256 KB
subtask2_06.txt AC 247 ms 256 KB
subtask2_07.txt AC 340 ms 256 KB
subtask2_08.txt AC 262 ms 256 KB
subtask2_09.txt AC 1451 ms 256 KB
subtask2_10.txt AC 1889 ms 256 KB
subtask2_11.txt AC 767 ms 256 KB
subtask2_12.txt TLE
subtask2_13.txt AC 464 ms 256 KB
subtask2_14.txt AC 307 ms 256 KB
subtask2_15.txt AC 1 ms 256 KB
subtask2_16.txt AC 165 ms 256 KB
subtask2_17.txt AC 2485 ms 256 KB
subtask2_18.txt AC 1474 ms 256 KB
subtask2_19.txt AC 1208 ms 256 KB
subtask2_20.txt AC 1022 ms 256 KB
subtask2_21.txt AC 1914 ms 256 KB
subtask2_22.txt AC 1925 ms 256 KB
subtask2_23.txt AC 2906 ms 256 KB
subtask2_24.txt AC 887 ms 256 KB
subtask2_25.txt TLE
subtask3_01.txt AC 1 ms 256 KB
subtask3_02.txt AC 9 ms 256 KB
subtask3_03.txt AC 3 ms 256 KB
subtask3_04.txt AC 9 ms 256 KB
subtask3_05.txt AC 63 ms 256 KB
subtask3_06.txt AC 62 ms 256 KB
subtask3_07.txt AC 24 ms 256 KB
subtask3_08.txt AC 285 ms 256 KB
subtask3_09.txt AC 554 ms 256 KB
subtask3_10.txt AC 1798 ms 256 KB
subtask3_11.txt AC 574 ms 256 KB
subtask3_12.txt TLE
subtask3_13.txt AC 1963 ms 256 KB
subtask3_14.txt AC 943 ms 256 KB
subtask3_15.txt AC 1227 ms 256 KB
subtask3_16.txt AC 775 ms 256 KB
subtask3_17.txt AC 3272 ms 256 KB
subtask3_18.txt AC 56 ms 256 KB
subtask3_19.txt AC 664 ms 256 KB
subtask3_20.txt AC 212 ms 256 KB
subtask3_21.txt TLE
subtask3_22.txt AC 1600 ms 256 KB
subtask3_23.txt TLE
subtask3_24.txt AC 3379 ms 256 KB
subtask3_25.txt AC 504 ms 256 KB