답안 #951520

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
951520 2024-03-22T04:49:04 Z GrindMachine Navigation 2 (JOI21_navigation2) C++17
0 / 100
11 ms 920 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

template<typename T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long int ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL)
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define setbits(x) __builtin_popcountll(x)
#define ff first
#define ss second
#define conts continue
#define ceil2(x,y) ((x+y-1)/(y))
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define yes cout << "Yes" << endl
#define no cout << "No" << endl

#define rep(i,n) for(int i = 0; i < n; ++i)
#define rep1(i,n) for(int i = 1; i <= n; ++i)
#define rev(i,s,e) for(int i = s; i >= e; --i)
#define trav(i,a) for(auto &i : a)

template<typename T>
void amin(T &a, T b) {
    a = min(a,b);
}

template<typename T>
void amax(T &a, T b) {
    a = max(a,b);
}

#ifdef LOCAL
#include "debug.h"
#else
#define debug(x) 42
#endif

/*

refs:
edi
https://codeforces.com/blog/entry/88748?#comment-774016 (this thread)

*/

const int MOD = 1e9 + 7;
const int N = 1e5 + 5;
const int inf1 = int(1e9) + 5;
const ll inf2 = ll(1e18) + 5;

#include "Anna.h"

void Anna(int n, int k, std::vector<int> R, std::vector<int> C) {
    rep(i,n){
        rep(j,n){
            int mask = 0;
            rev(x,k-1,0){
                int r = R[x], c = C[x];
                int d = abs(i-r)+abs(j-c);
                d %= 3;
                mask = mask*3+d;
            }

            SetFlag(i,j,mask);
        }
    }
}
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

template<typename T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long int ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL)
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define setbits(x) __builtin_popcountll(x)
#define ff first
#define ss second
#define conts continue
#define ceil2(x,y) ((x+y-1)/(y))
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define yes cout << "Yes" << endl
#define no cout << "No" << endl

#define rep(i,n) for(int i = 0; i < n; ++i)
#define rep1(i,n) for(int i = 1; i <= n; ++i)
#define rev(i,s,e) for(int i = s; i >= e; --i)
#define trav(i,a) for(auto &i : a)

template<typename T>
void amin(T &a, T b) {
    a = min(a,b);
}

template<typename T>
void amax(T &a, T b) {
    a = max(a,b);
}

#ifdef LOCAL
#include "debug.h"
#else
#define debug(x) 42
#endif

/*

refs:
edi
https://codeforces.com/blog/entry/88748?#comment-774016 (this thread)

*/

const int MOD = 1e9 + 7;
const int N = 1e5 + 5;
const int inf1 = int(1e9) + 5;
const ll inf2 = ll(1e18) + 5;

#include "Bruno.h"

std::vector<int> Bruno(int k, std::vector<int> values) {
    int a[3][3];
    memset(a,0,sizeof a);
    rep(i,sz(values)){
        a[i/3][i%3] = values[i];
    }

    int b[3][3];

    vector<pii> cells = {{1,2},{1,0},{2,1},{0,1}};
    vector<int> ans;
    
    rep(x,k){
        rep(i,3){
            rep(j,3){
                int &mask = a[i][j];
                b[i][j] = mask%3;
                mask /= 3;
            }
        }

        int final_dir = 4;

        rep(dir,4){
            auto [i,j] = cells[dir];
            if((b[i][j]+1)%3 == b[1][1]){
                final_dir = dir;
            }
        }

        ans.pb(final_dir);
    }

    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 9 ms 664 KB Partially correct
2 Partially correct 8 ms 920 KB Partially correct
3 Partially correct 8 ms 664 KB Partially correct
4 Partially correct 7 ms 920 KB Partially correct
5 Partially correct 9 ms 920 KB Partially correct
6 Partially correct 9 ms 664 KB Partially correct
7 Partially correct 9 ms 920 KB Partially correct
8 Partially correct 9 ms 920 KB Partially correct
9 Partially correct 9 ms 920 KB Partially correct
10 Partially correct 9 ms 920 KB Partially correct
11 Partially correct 9 ms 664 KB Partially correct
12 Partially correct 8 ms 664 KB Partially correct
13 Partially correct 7 ms 664 KB Partially correct
14 Partially correct 9 ms 920 KB Partially correct
15 Partially correct 10 ms 664 KB Partially correct
16 Partially correct 9 ms 920 KB Partially correct
17 Partially correct 9 ms 920 KB Partially correct
18 Partially correct 9 ms 664 KB Partially correct
19 Partially correct 9 ms 664 KB Partially correct
20 Partially correct 9 ms 920 KB Partially correct
21 Partially correct 9 ms 920 KB Partially correct
22 Partially correct 9 ms 664 KB Partially correct
23 Partially correct 11 ms 664 KB Partially correct
24 Partially correct 7 ms 664 KB Partially correct
25 Partially correct 8 ms 664 KB Partially correct
26 Partially correct 8 ms 920 KB Partially correct
27 Partially correct 9 ms 664 KB Partially correct
28 Partially correct 8 ms 664 KB Partially correct
29 Partially correct 9 ms 920 KB Partially correct
30 Partially correct 8 ms 920 KB Partially correct
31 Partially correct 7 ms 748 KB Partially correct
32 Partially correct 8 ms 676 KB Partially correct
33 Partially correct 9 ms 664 KB Partially correct
34 Partially correct 9 ms 664 KB Partially correct
35 Partially correct 9 ms 920 KB Partially correct
36 Partially correct 10 ms 664 KB Partially correct
37 Partially correct 7 ms 664 KB Partially correct
38 Partially correct 9 ms 664 KB Partially correct
39 Incorrect 3 ms 332 KB Wrong Answer [2]
40 Halted 0 ms 0 KB -