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

Submission #169746

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;
memset(a,0,sizeof(a));
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];
}
}
}
/*
rep(i,h){
rep(j,w){
cout<<a[i][j]<<" ";
}
cout<<endl;
}
cout<<endl;
cout<<tmp<<endl;
*/
ans=max(ans,tmp);
}while(next_permutation(ALL(vp)));

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

Submission Info

Submission Time 2014-05-10 22:40:04+0900 D - 金塊ゲーム j_gui0121 C++ (G++ 4.6.4) 0 1607 Byte WA 4032 ms 1000 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 34 ms 812 KB
sample_02.txt AC 22 ms 920 KB
sample_03.txt AC 59 ms 876 KB
subtask1_01.txt AC 23 ms 928 KB
subtask1_02.txt WA 25 ms 912 KB
subtask1_03.txt AC 49 ms 800 KB
subtask1_04.txt WA 91 ms 812 KB
subtask1_05.txt WA 22 ms 868 KB
subtask1_06.txt AC 22 ms 916 KB
subtask1_07.txt WA 23 ms 880 KB
subtask1_08.txt AC 23 ms 968 KB
subtask1_09.txt RE 248 ms 920 KB
subtask1_10.txt RE 242 ms 792 KB
subtask1_11.txt RE 257 ms 796 KB
subtask1_12.txt WA 25 ms 876 KB
subtask1_13.txt AC 24 ms 920 KB
subtask1_14.txt RE 260 ms 784 KB
subtask1_15.txt RE 248 ms 788 KB
subtask1_16.txt WA 117 ms 868 KB
subtask1_17.txt WA 147 ms 796 KB
subtask1_18.txt WA 61 ms 872 KB
subtask1_19.txt AC 47 ms 800 KB
subtask1_20.txt AC 46 ms 876 KB
subtask1_21.txt WA 171 ms 872 KB
subtask1_22.txt WA 154 ms 800 KB
subtask1_23.txt WA 62 ms 872 KB
subtask1_24.txt WA 331 ms 876 KB
subtask1_25.txt RE 254 ms 824 KB
subtask2_01.txt TLE 4031 ms 876 KB
subtask2_02.txt TLE 4031 ms 992 KB
subtask2_03.txt TLE 4030 ms 876 KB
subtask2_04.txt RE 252 ms 920 KB
subtask2_05.txt TLE 4031 ms 988 KB
subtask2_06.txt TLE 4031 ms 880 KB
subtask2_07.txt TLE 4032 ms 876 KB
subtask2_08.txt TLE 4032 ms 872 KB
subtask2_09.txt TLE 4031 ms 904 KB
subtask2_10.txt TLE 4032 ms 992 KB
subtask2_11.txt TLE 4031 ms 872 KB
subtask2_12.txt RE 257 ms 796 KB
subtask2_13.txt RE 257 ms 796 KB
subtask2_14.txt RE 256 ms 796 KB
subtask2_15.txt RE 257 ms 804 KB
subtask2_16.txt TLE 4032 ms 868 KB
subtask2_17.txt TLE 4031 ms 988 KB
subtask2_18.txt RE 253 ms 792 KB
subtask2_19.txt TLE 4031 ms 868 KB
subtask2_20.txt TLE 4031 ms 876 KB
subtask2_21.txt TLE 4031 ms 876 KB
subtask2_22.txt TLE 4032 ms 1000 KB
subtask2_23.txt TLE 4031 ms 1000 KB
subtask2_24.txt RE 254 ms 860 KB
subtask2_25.txt RE 251 ms 792 KB
subtask3_01.txt RE 256 ms 796 KB
subtask3_02.txt RE 256 ms 860 KB
subtask3_03.txt RE 243 ms 796 KB
subtask3_04.txt RE 242 ms 796 KB
subtask3_05.txt RE 244 ms 872 KB
subtask3_06.txt RE 245 ms 916 KB
subtask3_07.txt RE 251 ms 796 KB
subtask3_08.txt RE 253 ms 868 KB
subtask3_09.txt RE 253 ms 796 KB
subtask3_10.txt RE 244 ms 748 KB
subtask3_11.txt RE 249 ms 796 KB
subtask3_12.txt RE 269 ms 796 KB
subtask3_13.txt RE 247 ms 812 KB
subtask3_14.txt RE 249 ms 800 KB
subtask3_15.txt RE 245 ms 792 KB
subtask3_16.txt RE 252 ms 800 KB
subtask3_17.txt RE 259 ms 752 KB
subtask3_18.txt RE 265 ms 788 KB
subtask3_19.txt RE 262 ms 792 KB
subtask3_20.txt RE 267 ms 808 KB
subtask3_21.txt RE 261 ms 856 KB
subtask3_22.txt RE 254 ms 788 KB
subtask3_23.txt RE 250 ms 788 KB
subtask3_24.txt RE 255 ms 796 KB
subtask3_25.txt RE 252 ms 880 KB