답안 #415047

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
415047 2021-05-31T13:13:34 Z 반딧불(#7587) Navigation 2 (JOI21_navigation2) C++17
0 / 100
18 ms 560 KB
#include "Anna.h"
#include <bits/stdc++.h>

using namespace std;

namespace {
    int n, k;
    int x[10], y[10];
}

void Anna(int N, int K, vector<int> R, vector<int> C) {
    n = N, k = K;
    for(int i=0; i<k; i++) x[i] = R[i], y[i] = C[i];

    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            int d = (i%3) * 3 + (j%3);
            if(d == k){
                SetFlag(i, j, 5);
                continue;
            }
            if(d > k){
                SetFlag(i, j, 4);
                continue;
            }

            if(abs(i-x[d]) <= 1 && abs(j-y[d]) <= 1){
                SetFlag(i, j, (x[d]-i+1) * 3 + (y[d]-j+1) + 1);
                continue;
            }

            if(x[d] < i - 1) SetFlag(i, j, 10);
            else if(y[d] < j - 1) SetFlag(i, j, 11);
            else if(x[d] > i + 1) SetFlag(i, j, 12);
            else if(y[d] > j + 1) SetFlag(i, j, 13);
            else exit(1);
        }
    }
}
#include "Bruno.h"
#include <bits/stdc++.h>

using namespace std;

namespace {
    int k;
    int input[6][6];
    vector<int> ret;
}

vector<int> Bruno(int K, vector<int> value) {
    k = K;
    ret = vector<int> (K, 0);

    int zeroX = -1, zeroY = -1;
    for(int i=0; i<9; i++){
        int x = i/3, y = i%3;
        input[x][y] = input[x+3][y] = input[x][y+3] = input[x+3][y+3] = value[i];
    }

    for(int i=0; i<3; i++){
        for(int j=0; j<3; j++){
            if(input[i][j] == 5 && input[i][j+1] == 4){
                zeroX = i+1, zeroY = j+2;
            }
        }
    }

    for(int d=0; d<k; d++){
        int x = (d/3 + zeroX) % 3, y = (d%3 + zeroY) % 3;
        if(input[x][y] <= 9){
            int xt = x + (input[x][y]-1)/3 - 1;
            int yt = y + (input[x][y]-1)%3 - 1;

            if(xt == 1 && yt == 1) ret[d] = 4;
            else if(xt < 1) ret[d] = 3;
            else if(xt > 1) ret[d] = 2;
            else if(yt < 1) ret[d] = 1;
            else if(yt > 1) ret[d] = 0;
        }
        else{
            if(input[x][y] == 10) ret[d] = 3;
            else if(input[x][y] == 11) ret[d] = 1;
            else if(input[x][y] == 12) ret[d] = 2;
            else if(input[x][y] == 13) ret[d] = 0;
        }
    }
    return ret;
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 13 ms 560 KB Partially correct
2 Partially correct 14 ms 384 KB Partially correct
3 Partially correct 17 ms 384 KB Partially correct
4 Partially correct 13 ms 384 KB Partially correct
5 Partially correct 14 ms 384 KB Partially correct
6 Partially correct 18 ms 384 KB Partially correct
7 Partially correct 17 ms 384 KB Partially correct
8 Incorrect 9 ms 192 KB Wrong Answer [7]
9 Halted 0 ms 0 KB -