답안 #59844

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
59844 2018-07-23T07:59:05 Z 노영훈(#1724) Cultivation (JOI17_cultivation) C++11
5 / 100
2000 ms 680 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int MX=500010, inf=2e9;

int n, r0, c0;
struct pt{
    int x, y;
    void scan(){
        cin>>x>>y;
    }
} P[310];

bool solve4(int a, int b, int c, int d){
    bool B[50][50]={};
    for(int i=1; i<=n; i++){
        for(int x=max(1, P[i].x-a); x<=min(r0, P[i].x+b); x++)
            for(int y=max(1, P[i].y-c); y<=min(c0, P[i].y+d); y++)
                B[x][y]=true;
    }
    for(int x=1; x<=r0; x++)
        for(int y=1; y<=c0; y++)
            if(!B[x][y]) return false;
    return true;
}
int main(){
    ios::sync_with_stdio(0); cin.tie(0);
    cin>>r0>>c0>>n;
    for(int i=1; i<=n; i++){
        P[i].scan();
    }
    int ans=inf;
    if(r0*c0*n>=1e8) return 0;
    for(int a=0; a<=r0; a++)
        for(int b=0; b<=r0; b++)
            for(int c=0; c<=c0; c++)
                for(int d=0; d<=c0; d++)
                    if(solve4(a,b,c,d)) ans=min(ans, a+b+c+d);
    cout<<ans;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 3 ms 484 KB Output is correct
3 Correct 3 ms 484 KB Output is correct
4 Correct 2 ms 588 KB Output is correct
5 Correct 3 ms 588 KB Output is correct
6 Correct 3 ms 588 KB Output is correct
7 Correct 2 ms 588 KB Output is correct
8 Correct 2 ms 588 KB Output is correct
9 Correct 3 ms 680 KB Output is correct
10 Correct 2 ms 680 KB Output is correct
11 Correct 2 ms 680 KB Output is correct
12 Correct 3 ms 680 KB Output is correct
13 Correct 3 ms 680 KB Output is correct
14 Correct 2 ms 680 KB Output is correct
15 Correct 4 ms 680 KB Output is correct
16 Correct 2 ms 680 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 3 ms 484 KB Output is correct
3 Correct 3 ms 484 KB Output is correct
4 Correct 2 ms 588 KB Output is correct
5 Correct 3 ms 588 KB Output is correct
6 Correct 3 ms 588 KB Output is correct
7 Correct 2 ms 588 KB Output is correct
8 Correct 2 ms 588 KB Output is correct
9 Correct 3 ms 680 KB Output is correct
10 Correct 2 ms 680 KB Output is correct
11 Correct 2 ms 680 KB Output is correct
12 Correct 3 ms 680 KB Output is correct
13 Correct 3 ms 680 KB Output is correct
14 Correct 2 ms 680 KB Output is correct
15 Correct 4 ms 680 KB Output is correct
16 Correct 2 ms 680 KB Output is correct
17 Correct 139 ms 680 KB Output is correct
18 Execution timed out 2056 ms 680 KB Time limit exceeded
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 3 ms 484 KB Output is correct
3 Correct 3 ms 484 KB Output is correct
4 Correct 2 ms 588 KB Output is correct
5 Correct 3 ms 588 KB Output is correct
6 Correct 3 ms 588 KB Output is correct
7 Correct 2 ms 588 KB Output is correct
8 Correct 2 ms 588 KB Output is correct
9 Correct 3 ms 680 KB Output is correct
10 Correct 2 ms 680 KB Output is correct
11 Correct 2 ms 680 KB Output is correct
12 Correct 3 ms 680 KB Output is correct
13 Correct 3 ms 680 KB Output is correct
14 Correct 2 ms 680 KB Output is correct
15 Correct 4 ms 680 KB Output is correct
16 Correct 2 ms 680 KB Output is correct
17 Correct 139 ms 680 KB Output is correct
18 Execution timed out 2056 ms 680 KB Time limit exceeded
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 680 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 680 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 3 ms 484 KB Output is correct
3 Correct 3 ms 484 KB Output is correct
4 Correct 2 ms 588 KB Output is correct
5 Correct 3 ms 588 KB Output is correct
6 Correct 3 ms 588 KB Output is correct
7 Correct 2 ms 588 KB Output is correct
8 Correct 2 ms 588 KB Output is correct
9 Correct 3 ms 680 KB Output is correct
10 Correct 2 ms 680 KB Output is correct
11 Correct 2 ms 680 KB Output is correct
12 Correct 3 ms 680 KB Output is correct
13 Correct 3 ms 680 KB Output is correct
14 Correct 2 ms 680 KB Output is correct
15 Correct 4 ms 680 KB Output is correct
16 Correct 2 ms 680 KB Output is correct
17 Correct 139 ms 680 KB Output is correct
18 Execution timed out 2056 ms 680 KB Time limit exceeded
19 Halted 0 ms 0 KB -