Submission #575288

# Submission time Handle Problem Language Result Execution time Memory
575288 2022-06-10T06:00:18 Z balbit Navigation 2 (JOI21_navigation2) C++17
0 / 100
1 ms 200 KB
#include "Anna.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pii pair<int, int>
#define f first
#define s second

#define REP(i,n) for (int i = 0; i<n; ++i)
#define REP1(i,n) for (int i = 1; i<=n; ++i)

#define MX(a,b) a = max(a,b)
#define MN(a,b) a = min(a,b)
#define pb push_back
#define SZ(x) (int)(x).size()
#define ALL(x) (x).begin(), (x).end()

#ifdef BALBIT
#define bug(...) cerr<<"#"<<__LINE__<<": "<<#__VA_ARGS__<<"- ", _do(__VA_ARGS__)
template<typename T> void _do(T && x) {cerr<<x<<endl;}
template<typename T, typename ...S> void _do(T && x, S && ...y) {cerr<<x<<", "; _do(y...);}
#else
#define bug(...)

#endif // BALBIT


namespace {

int FunctionExample(int r, int c, int K) {
  return (r + c) % K + 1;
}

const int maxn = 505;
int g[maxn][maxn];

int get(int r, int c, int tr, int tc) {
    if (max(abs(r - tr) , abs(c - tc) ) <= 1) {
        return (tr-r+1) * 3 + (tc - c+1) + 1;
    }else{
        if (r < tr) return 10; // r++
        if (r > tr) return 11; // r--;
        if (c > tc) return 12; // c++
        if (c < tc) return 13; // c--;
    }
}

#ifdef BALBIT

#endif // BALBIT

} // namespace

void Anna(int N, int K, vector<int> R, vector<int> C) {
    for (int r = 0; r < N; r++) {
        for (int c = 0; c < N; c++) {
            int id = (r % 3) * 3 + (c % 3);
            if (id < K) {
                SetFlag(r, c, get(r, c, R[id],C[id]));
            }else{
                SetFlag(r, c, 14);
            }
        }
    }
}







#include "Bruno.h"
#include <vector>
//#define BALBIT
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pii pair<int, int>
#define f first
#define s second

#define REP(i,n) for (int i = 0; i<n; ++i)
#define REP1(i,n) for (int i = 1; i<=n; ++i)

#define MX(a,b) a = max(a,b)
#define MN(a,b) a = min(a,b)
#define pb push_back
#define SZ(x) (int)(x).size()
#define ALL(x) (x).begin(), (x).end()

#ifdef BALBIT
#define bug(...) cerr<<"#"<<__LINE__<<": "<<#__VA_ARGS__<<"- ", _do(__VA_ARGS__)
template<typename T> void _do(T && x) {cerr<<x<<endl;}
template<typename T, typename ...S> void _do(T && x, S && ...y) {cerr<<x<<", "; _do(y...);}
#else
#define bug(...)

#endif // BALBIT


namespace {

int FunctionExample(int r, int c, int K) {
  return (r + c) % K + 1;
}

const int maxn = 505;
}

std::vector<int> Bruno(int K, std::vector<int> value) {
    array<array<int, 5>, 5> tmp;
    REP(i,5) REP(j,5) {
        tmp[i][j] = (i % 3) * 3 + (j % 3);
//        bug(i,j,tmp[i][j]);
    }
    for (int ti = 1; ti <= 3; ++ti) for (int tj = 1; tj <= 3; ++tj) {
        // test it
        vector<int> re(K);
        bool ok = 1;
        int it = 0;
        for (int di = -1; di <= 1; ++di) for (int dj = -1; dj <= 1; ++dj) {

            if (value[it] == 14) {
                if (tmp[ti + di][tj + dj] < K) {
                    ok = 0; goto nope;
                }
            }

            ++it;
        }

        bug(ti, tj);

        assert(ok);
        it = 0;
        for (int di = -1; di <= 1; ++di) for (int dj = -1; dj <= 1; ++dj) {

            int hi = value[it];
            bug(it, hi);
            if (value[it] == 14) {
                ++it; continue;
            }
            int who = tmp[ti + di][tj + dj];
            if (value[it] >= 10) {
                if (value[it] == 10) re[who] = 2;
                if (value[it] == 11) re[who] = 3;
                if (value[it] == 12) re[who] = 0;
                if (value[it] == 13) re[who] = 1;
            }else{
                int ai = di + (hi-1)/3-1;
                int aj = dj + (hi-1)%3-1;
                if (ai == 0 && aj == 0) {
                    re[who] = 4;
                }else{
                    if (0 < ai) re[who] = 2;
                    if (0 > ai) re[who] = 3;
                    if (0 < aj) re[who] = 0;
                    if (0 > aj) re[who] = 1;
                }
            }

            bug(it, who, re[who]);

            ++it;
        }

        return re;

        nope:;
    }

}


/*
1
7 7
2 2
2 3
4 5
4 2
6 4
3 2
3 3
3 3
*/

Compilation message

Anna.cpp: In function 'int {anonymous}::get(int, int, int, int)':
Anna.cpp:48:1: warning: control reaches end of non-void function [-Wreturn-type]
   48 | }
      | ^
Anna.cpp: At global scope:
Anna.cpp:37:5: warning: '{anonymous}::g' defined but not used [-Wunused-variable]
   37 | int g[maxn][maxn];
      |     ^
Anna.cpp:32:5: warning: 'int {anonymous}::FunctionExample(int, int, int)' defined but not used [-Wunused-function]
   32 | int FunctionExample(int r, int c, int K) {
      |     ^~~~~~~~~~~~~~~

Bruno.cpp: In function 'std::vector<int> Bruno(int, std::vector<int>)':
Bruno.cpp:102:1: warning: control reaches end of non-void function [-Wreturn-type]
  102 | }
      | ^
Bruno.cpp: At global scope:
Bruno.cpp:33:5: warning: 'int {anonymous}::FunctionExample(int, int, int)' defined but not used [-Wunused-function]
   33 | int FunctionExample(int r, int c, int K) {
      |     ^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -