답안 #148345

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
148345 2019-09-01T03:26:38 Z JeffreyHo(#3775, JeffreyHo) 체스판 네모네모로직 (FXCUP4_nonogram) C++17
100 / 100
6 ms 512 KB
#include "nonogram.h"
using namespace std;

std::vector<std::vector<int>> SolveNonogram(int n, int m, std::vector<std::vector<int>> r, std::vector<std::vector<int>> c) {
    vector<vector<int>> z(n);
    for (int i = 0; i < n; i++) z[i].resize(m);
    for (int i = 0; i < n; i++) {
        if (r[i][0] == m - 1) {
            for (int j = 1; j + 1 < m; j++) z[i][j] = 1;
        } else {
            int d = i % 2;
            if (i % 2 && r[i][0] % 2 == 0) r[i][0]--, z[i][0] = 1;
            for (int j : r[i]) {
                while (j--) z[i][d++] = 1;
                d++;
            }
        }
    }
    int d = 0;
    for (int j : c[0]) {
        while (j--) {
            z[d][0] = 1;
            d++;
        }
        if (d < n && r[d][0] == m - 1) z[d][m - 1] = 1;
        d++;
    }
    return z;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 5 ms 128 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 5 ms 128 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 6 ms 384 KB Output is correct
7 Correct 6 ms 384 KB Output is correct
8 Correct 6 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 6 ms 512 KB Output is correct
11 Correct 6 ms 512 KB Output is correct
12 Correct 6 ms 384 KB Output is correct
13 Correct 6 ms 512 KB Output is correct
14 Correct 6 ms 512 KB Output is correct
15 Correct 6 ms 512 KB Output is correct