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

Submission #169631

Source Code Expand

Copy
```#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <complex>
#include <map>
#include <climits>
using namespace std;

#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second
#define mkp make_pair

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vint;
static const int INF=1<<24;
int a[10][10];
int ve[4][2]={0,1,0,-1,1,0,-1,0};
int main(){

int h,w;
cin>>h>>w;
int n;
vector<pii> vp;
cin>>n;
rep(i,n){
vp.PB(mkp(0,0));
int q,r;
cin>>q>>r;
q--;
r--;
vp[i]=mkp(q,r);
}
sort(ALL(vp));

int ans=0;

do{
int tmp=0;
vector<pii> tp;
tp=vp;
rep(i,h){
rep(j,w){
a[i][j]=1;
}
}
rep(i,n){
//cout<<tp[i].F<<" "<<tp[i].S<<endl;
if(a[tp[i].F][tp[i].S]==1){
a[tp[i].F][tp[i].S]=0;
tmp++;
}
rep(j,4){
int x=tp[i].F+ve[j][0],y=tp[i].S+ve[j][1];
while(a[x][y]==1&&x>=0&&y>=0&&x<h&&y<w){
tmp++;
a[x][y]=0;
x+=ve[j][0];
y+=ve[j][1];
}
//cout<<"xy "<<x<<" "<<y<<endl;
/*
if(1){
x-=ve[j][0];
y-=ve[j][1];
while(x!=tp[i].F&&tp[i].S!=y){
a[x][y]=0;
tmp++;
x-=ve[j][0];
y-=ve[j][1];
}
}
*/
}
}
/*
rep(i,h){
rep(j,w){
cout<<a[i][j]<<" ";
}
cout<<endl;
}
cout<<endl;
*/
ans=max(ans,tmp);
}while(next_permutation(ALL(vp)));

cout<<ans<<endl;
return 0;
}```

#### Submission Info

Submission Time 2014-05-10 22:21:14+0900 D - 金塊ゲーム j_gui0121 C++ (G++ 4.6.4) 0 1788 Byte WA 4035 ms 928 KB

#### Judge Result

Score / Max Score 0 / 0 0 / 80 0 / 19 0 / 1
Status
 AC × 3
 AC × 7 WA × 12 RE × 6
 AC × 7 WA × 12 TLE × 17 RE × 14
 AC × 7 WA × 12 TLE × 17 RE × 39
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
sample_01.txt AC 21 ms 920 KB
sample_02.txt AC 21 ms 912 KB
sample_03.txt AC 62 ms 804 KB
subtask1_01.txt AC 21 ms 912 KB
subtask1_02.txt WA 22 ms 788 KB
subtask1_03.txt AC 52 ms 788 KB
subtask1_04.txt WA 87 ms 796 KB
subtask1_05.txt WA 21 ms 808 KB
subtask1_06.txt AC 22 ms 916 KB
subtask1_07.txt WA 22 ms 920 KB
subtask1_08.txt AC 21 ms 920 KB
subtask1_09.txt RE 244 ms 796 KB
subtask1_10.txt RE 251 ms 788 KB
subtask1_11.txt RE 233 ms 796 KB
subtask1_12.txt WA 22 ms 920 KB
subtask1_13.txt AC 24 ms 796 KB
subtask1_14.txt RE 251 ms 788 KB
subtask1_15.txt RE 245 ms 788 KB
subtask1_16.txt WA 112 ms 792 KB
subtask1_17.txt WA 132 ms 720 KB
subtask1_18.txt WA 65 ms 800 KB
subtask1_19.txt AC 55 ms 796 KB
subtask1_20.txt AC 55 ms 828 KB
subtask1_21.txt WA 157 ms 804 KB
subtask1_22.txt WA 118 ms 796 KB
subtask1_23.txt WA 62 ms 796 KB
subtask1_24.txt WA 222 ms 788 KB
subtask1_25.txt RE 256 ms 792 KB
subtask2_01.txt TLE 4031 ms 928 KB
subtask2_02.txt TLE 4031 ms 812 KB
subtask2_03.txt TLE 4032 ms 812 KB
subtask2_04.txt RE 238 ms 796 KB
subtask2_05.txt TLE 4034 ms 896 KB
subtask2_06.txt TLE 4030 ms 812 KB
subtask2_07.txt TLE 4035 ms 808 KB
subtask2_08.txt TLE 4030 ms 816 KB
subtask2_09.txt TLE 4031 ms 812 KB
subtask2_10.txt TLE 4030 ms 812 KB
subtask2_11.txt TLE 4030 ms 800 KB
subtask2_12.txt RE 234 ms 796 KB
subtask2_13.txt RE 230 ms 788 KB
subtask2_14.txt RE 234 ms 788 KB
subtask2_15.txt RE 243 ms 792 KB
subtask2_16.txt TLE 4028 ms 808 KB
subtask2_17.txt TLE 4028 ms 804 KB
subtask2_18.txt RE 230 ms 796 KB
subtask2_19.txt TLE 4030 ms 808 KB
subtask2_20.txt TLE 4030 ms 800 KB
subtask2_21.txt TLE 4032 ms 804 KB
subtask2_22.txt TLE 4030 ms 808 KB
subtask2_23.txt TLE 4029 ms 808 KB
subtask2_24.txt RE 259 ms 784 KB
subtask2_25.txt RE 262 ms 792 KB
subtask3_01.txt RE 269 ms 748 KB
subtask3_02.txt RE 258 ms 916 KB
subtask3_03.txt RE 254 ms 792 KB
subtask3_04.txt RE 265 ms 792 KB
subtask3_05.txt RE 232 ms 792 KB
subtask3_06.txt RE 244 ms 736 KB
subtask3_07.txt RE 242 ms 788 KB
subtask3_08.txt RE 267 ms 720 KB
subtask3_09.txt RE 252 ms 792 KB
subtask3_10.txt RE 246 ms 792 KB
subtask3_11.txt RE 241 ms 796 KB
subtask3_12.txt RE 264 ms 788 KB
subtask3_13.txt RE 265 ms 792 KB
subtask3_14.txt RE 257 ms 788 KB
subtask3_15.txt RE 250 ms 804 KB
subtask3_16.txt RE 228 ms 784 KB
subtask3_17.txt RE 229 ms 788 KB
subtask3_18.txt RE 240 ms 792 KB
subtask3_19.txt RE 230 ms 788 KB
subtask3_20.txt RE 241 ms 792 KB
subtask3_21.txt RE 245 ms 788 KB
subtask3_22.txt RE 240 ms 712 KB
subtask3_23.txt RE 236 ms 788 KB
subtask3_24.txt RE 244 ms 788 KB
subtask3_25.txt RE 233 ms 916 KB