제출 #1330187

#제출 시각아이디문제언어결과실행 시간메모리
1330187nicolo_010Navigation 2 (JOI21_navigation2)C++20
13 / 100
575 ms900 KiB
#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;

int direction(int i, int j, int r, int c) {
    int ans=0;
    //0 = east, 1=west, 2 = south, 3=north
    if (r<i) ans = 3;
    if (i<r) ans = 2;
    if (j>c) ans = 1;
    if (j<c) ans = 0;
    return ans;
}

bool flag = false;

int f(vector<int> &num) {
    int ans=0;
    int n = num.size();
    for (int i=0; i<n; i++) {
        ans += num[i]*(1<<i);
    }
    return ans;
}

void Anna(int n, int K, std::vector<int> R, std::vector<int> C) {
    flag = false;
    for (int i=0; i<n; i++) {
        for (int j=0; j<n; j++) {
            flag = false;
            vector<int> vals;
            for (int c=0; c<K; c++) {
                int dir = direction(i, j, R[c], C[c]);
                for (int b=0; b<2; b++) {
                    if (dir&(1<<b)) {
                        vals.push_back(1);
                    }
                    else {
                        vals.push_back(0);
                    }
                }
            }
            vals.push_back(1);
            SetFlag(i, j, f(vals));
        }
    }
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int t(int x) {
    return (x&(1)) + (x&(2));
}
std::vector<int> Bruno(int K, std::vector<int> value) {
    vector<int> ans;
    for (int i=0; i<K; i++) {
        int num = t(value[4]);
        if (num>0) {
            ans.push_back(num);
        }
        else {
            int l = t(value[3]);
            int r = t(value[5]);
            int u = t(value[1]);
            int d = t(value[7]);
            if (l==0 && r == 1 && u == 2 && d == 3) {
                ans.push_back(4);
            }
            else {
                ans.push_back(0);
            }
        }
        for (int c=0; c<9; c++) {
            value[c] >>= 2;
        }
    }
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...