Submission #1588888
Source Code Expand
#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 Info
Submission Time |
|
Task |
A - アルバム |
User |
hiyokko3 |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
1134 Byte |
Status |
WA |
Exec Time |
1 ms |
Memory |
256 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
0 / 100 |
Status |
|
|
Set Name |
Test Cases |
Sample |
sample_01.txt, sample_02.txt |
All |
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 |
Case Name |
Status |
Exec Time |
Memory |
case_01.txt |
WA |
1 ms |
256 KB |
case_02.txt |
WA |
1 ms |
256 KB |
case_03.txt |
WA |
1 ms |
256 KB |
case_04.txt |
WA |
1 ms |
256 KB |
case_05.txt |
WA |
1 ms |
256 KB |
case_06.txt |
WA |
1 ms |
256 KB |
case_07.txt |
WA |
1 ms |
256 KB |
case_08.txt |
WA |
1 ms |
256 KB |
case_09.txt |
WA |
1 ms |
256 KB |
case_10.txt |
WA |
1 ms |
256 KB |
case_11.txt |
WA |
1 ms |
256 KB |
case_12.txt |
WA |
1 ms |
256 KB |
case_13.txt |
WA |
1 ms |
256 KB |
case_14.txt |
WA |
1 ms |
256 KB |
case_15.txt |
WA |
1 ms |
256 KB |
sample_01.txt |
WA |
1 ms |
256 KB |
sample_02.txt |
WA |
1 ms |
256 KB |