제출 #234156

#제출 시각아이디문제언어결과실행 시간메모리
234156qaws12보물 찾기 (CEOI13_treasure2)C++98
44 / 100
6 ms384 KiB
#include "treasure.h"
#define MAP 101

int map[MAP][MAP];

void findTreasure(int N) {
    for (int i = N; i > 0; i-- ) {
        for (int j = N; j > 0; j-- ) {
            map[i][j] = countTreasure(1,1, i, j);
        }
    }

    for (int i = N; i > 1; i--) {
        for (int j = N; j > 1; j--) {
            int answer = map[i][j] - map[i - 1][j] - map[i][j - 1] + map[i - 1][j - 1];
            if (answer == 1) {
                Report(i, j);
            }
        }
    }

    for (int i = N;i>1; i--) {
        int answer = map[1][i] - map[1][i - 1];
        if (answer == 1) {
            Report(1, i);
        }
        answer = map[i][1] - map[i - 1][1];
        if (answer == 1) {
            Report(i, 1);
        }
    }

    if (map[1][1] == 1) {
        Report(1, 1);
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...