답안 #415074

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
415074 2021-05-31T13:48:31 Z 반딧불(#7587) Navigation 2 (JOI21_navigation2) C++17
0 / 100
3 ms 192 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, 9);
                continue;
            }
            if(d > k){
                SetFlag(i, j, 9);
                continue;
            }

            if(abs(i-x[d]) <= 1 && abs(j-y[d]) <= 1){
                SetFlag(i, j, (x[d]%3) * 3 + (y[d]%3) + 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] == 9 && input[i][j+1] == 9){
                zeroX = i+1, zeroY = j+2;
            }
        }
    }

    for(int d=0; d<k; d++){
        int x = (d/3 + zeroX) % 3, y = (d%3 + zeroY) % 3; /// input ���̺����� ��ġ
        if(input[x][y] <= 9){
            int xm = (input[x][y]-1)/3;
            int ym = (input[x][y]-1)%3;
            int xt = x-1, yt = y-1;
            while((xt-zeroX+300)%3 != xm) xt++;
            while((yt-zeroY+300)%3 != ym) yt++;

            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 Incorrect 3 ms 192 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -