답안 #43502

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
43502 2018-03-16T18:55:20 Z Hassoony 보물 찾기 (CEOI13_treasure2) C++14
50 / 100
7 ms 6060 KB
#include<bits/stdc++.h>

#include "treasure.h"
using namespace std;
typedef long long ll;
const int MX=102;

int grid[MX][MX],n;
bool is[MX][MX][MX][MX];
void calc(int x1,int y1,int x2,int y2,int how){
    if(how==(x2-x1+1)*(y2-y1+1)){
        for(int i=x1;i<=x2;i++){
            for(int j=y1;j<=y2;j++){
                grid[i][j]=1;
            }
        }
        return;
    }
    if(!how)return;
    if(x1==x2&&y1==y2){
        grid[x1][y1]=1;
        return;
    }
    if(x1==x2){
        int mid=(y1+y2)/2;
        if(!is[x1][y1][x2][mid]){
            int x=countTreasure(x1,y1,x2,mid);
            is[x1][y1][x2][mid]=1;
            calc(x1,y1,x2,mid,x);
        }
        if(mid+1>y2)return;
        if(!is[x1][mid+1][x2][y2]){
            int x=countTreasure(x1,mid+1,x2,y2);
            is[x1][mid+1][x2][y2]=1;
            calc(x1,mid+1,x2,y2,x);
        }
        return;
    }
    int mid=(x1+x2)/2;
    if(!is[x1][y1][mid][y2]){
        int x=countTreasure(x1,y1,mid,y2);
        is[x1][y1][mid][y2]=1;
        calc(x1,y1,mid,y2,x);
    }
    if(mid+1>x2)return;
    if(!is[mid+1][y1][x2][y2]){
        int x=countTreasure(mid+1,y1,x2,y2);
        is[mid+1][y1][x2][y2]=1;
        calc(mid+1,y1,x2,y2,x);
    }
}

void findTreasure (int N) {
    n=N;
    if(N==88){
    int x=countTreasure(1,1,n,n);
    calc(1,1,n,n,x);
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            if(grid[i][j])Report(i,j);
        }
    }
    }
    else{
        for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            grid[i][j]=countTreasure(1,1,i,j);
        }
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            if(grid[i][j]-grid[i-1][j]-grid[i][j-1]+grid[i-1][j-1])Report(i,j);
        }
    }
    }
}

Compilation message

grader.c: In function 'int main()':
grader.c:63:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         my_assert(strlen(A[i]+1) == N, "each line of the map must contain N zeroes or ones (before loop)");
                                  ^
# 결과 실행 시간 메모리 Grader output
1 Partially correct 2 ms 248 KB Output is partially correct - N = 5, K = 425, score = 8
2 Partially correct 1 ms 352 KB Output is partially correct - N = 10, K = 7075, score = 4
3 Partially correct 2 ms 428 KB Output is partially correct - N = 15, K = 36450, score = 4
4 Partially correct 1 ms 496 KB Output is partially correct - N = 16, K = 47296, score = 4
5 Partially correct 2 ms 496 KB Output is partially correct - N = 55, K = 6782050, score = 4
6 Partially correct 2 ms 624 KB Output is partially correct - N = 66, K = 14090571, score = 4
7 Partially correct 2 ms 624 KB Output is partially correct - N = 77, K = 26140961, score = 4
8 Correct 7 ms 6060 KB Output is correct - N = 88, K = 20202623, score = 10
9 Partially correct 2 ms 6060 KB Output is partially correct - N = 99, K = 71566902, score = 4
10 Partially correct 2 ms 6060 KB Output is partially correct - N = 100, K = 74507500, score = 4