Submission #1344662

#TimeUsernameProblemLanguageResultExecution timeMemory
1344662avighnaNavigation 2 (JOI21_navigation2)C++20
0 / 100
0 ms692 KiB
#include "Anna.h"
#include <bits/stdc++.h>

using namespace std;

namespace {

enum dir {
  LEFT,
  RIGHT,
  UP,
  DOWN
};

}

void Anna(int N, int K, std::vector<int> R, std::vector<int> C) {
  auto serialize = [&](const vector<dir> &val) {
    int x = 0;
    for (const dir &i : val) {
      x = (4 * x + int(i));
    }
    return x + 1;
  };
  for (int r = 0; r < N; ++r) {
    for (int c = 0; c < N; ++c) {
      vector<dir> val;
      for (int i = 0; i < K; ++i) {
        if (R[i] == r) {
          if (C[i] <= c) {
            val.push_back(LEFT);
          } else {
            val.push_back(RIGHT);
          }
        } else {
          if (r <= R[i]) {
            val.push_back(DOWN);
          } else {
            val.push_back(UP);
          }
        }
      }
      SetFlag(r, c, serialize(val));
    }
  }
}
#include "Bruno.h"
#include <bits/stdc++.h>

using namespace std;

namespace {

enum dir {
  LEFT,
  RIGHT,
  UP,
  DOWN
};

}

vector<int> Bruno(int K, vector<int> value) {
  auto unserialize = [&](int x) {
    --x;
    vector<dir> res;
    for (int i = 0; i < 7; ++i) {
      res.push_back(dir(x % 4));
      x /= 4;
    }
    reverse(res.begin(), res.end());
    return res;
  };
  vector<int> ans;
  for (int i = 0; i < K; ++i) {
    vector vals(3, vector<dir>(3));
    for (int j = 0; j < 9; ++j) {
      vals[j / 3][j % 3] = unserialize(value[j])[i];
    }
    if (vals[1][0]==RIGHT&&vals[1][2]==LEFT&&vals[0][1]==DOWN&&vals[2][1]==UP){
      ans.push_back(4);continue;
    }
    if (vals[1][1]==LEFT) {
      ans.push_back(1);continue;
    }
    if (vals[1][1]==RIGHT) {
      ans.push_back(0);continue;
    }
    if (vals[1][1]==UP) {
      ans.push_back(3);continue;
    }
    if (vals[1][1]==DOWN) {
      ans.push_back(2);continue;
    }
    assert(false);
  }
  return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...