답안 #4529

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
4529 2013-10-20T05:53:17 Z tncks0121 보물 찾기 (CEOI13_treasure2) C++
44 / 100
0 ms 1400 KB
#include "treasure.h"
#include <stdio.h>

int A[105][105], B[105][105];
int R[105][105], SL[105][105], SR[105][105];
void findTreasure (int N) {
    int i, j;
    
    int T = N/2+1;
    for(i = T; i > 0; i--) {
        for(j = 1; j <= N; j++) {
            A[i][j] = countTreasure(i, 1, N, j);
            if(i < T) R[i][j] = A[i][j] - A[i+1][j] - A[i][j-1] + A[i+1][j-1];
        }
    }
    
    for(i = T; i <= N; i++) {
        for(j = 1; j <= N; j++) {
            B[i][j] = countTreasure(1, 1, i, j);
            if(i > T) R[i][j] = B[i][j] - B[i-1][j] - B[i][j-1] + B[i-1][j-1];
        }
    }
    
    for(i = 1; i <= T-1; i++) {
        for(j = 1; j <= N; j++) SL[i][j] = SL[i-1][j] + SL[i][j-1] - SL[i-1][j-1] + R[i][j];
        for(j = N; j >  0; j--) SR[i][j] = SR[i-1][j] + SR[i][j+1] - SR[i-1][j+1] + R[i][j];
        
    }
    
    for(j = 1; j <= N; j++) {
        SR[T][j] = B[T][N] - B[T][j-1];
        SL[T][j] = B[T][j];
    }
    
    for(j = 1; j <= N; j++) {
        if(j < T) {
            R[T][j] = SR[T][j] - SR[T-1][j] - SR[T][j+1] + SR[T-1][j+1];
        }else {
            R[T][j] = SL[T][j] - SL[T-1][j] - SL[T][j-1] + SL[T-1][j-1];
        }
    }
    
    for(i = 1; i <= N; i++) {
        //printf("%3d ", i);
        for(j = 1; j <= N; j++) {
            //printf("%3d",R[i][j]);
            if(R[i][j] == 1) Report(i, j);
        }
        //puts("");
    }
}

/*

*/

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 Incorrect 0 ms 1400 KB Output is partially correct - N = 5, K = 420, score = 8
2 Incorrect 0 ms 1400 KB Output is partially correct - N = 10, K = 6435, score = 4
3 Incorrect 0 ms 1400 KB Output is partially correct - N = 15, K = 32160, score = 4
4 Incorrect 0 ms 1400 KB Output is partially correct - N = 16, K = 41616, score = 4
5 Incorrect 0 ms 1400 KB Output is partially correct - N = 55, K = 5741120, score = 4
6 Incorrect 0 ms 1400 KB Output is partially correct - N = 66, K = 11897391, score = 4
7 Incorrect 0 ms 1400 KB Output is partially correct - N = 77, K = 22030008, score = 4
8 Incorrect 0 ms 1400 KB Output is partially correct - N = 88, K = 37570104, score = 4
9 Incorrect 0 ms 1400 KB Output is partially correct - N = 99, K = 60162300, score = 4
10 Incorrect 0 ms 1400 KB Output is partially correct - N = 100, K = 62630100, score = 4