Submission #869604

#TimeUsernameProblemLanguageResultExecution timeMemory
869604rxlfd314Navigation 2 (JOI21_navigation2)C++17
40 / 100
537 ms2424 KiB
#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;

#define vt vector
#define size(x) (int((x).size()))
#define all(x) begin(x), end(x)

#define REP(a, b, c, d) for (int a = (b); (d) > 0 ? a <= (c) : a >= (c); a += (d))
#define FOR(a, b, c) REP(a, b, c, 1)
#define ROF(a, b, c) REP(a, b, c, -1)

#define chmax(a, b) (a = a > (b) ? a : (b))
#define chmin(a, b) (a = a < (b) ? a : (b))

void Anna(int N, int K, vt<int> R, vt<int> C) {
  FOR(i, 0, N-1)
    FOR(j, 0, N-1) {
      int v = 0;
      if (i % 3 == 0 && j % 3 == 0)
        v = 128;
      else if (i % 3 == 0 && j % 3 == 1 || i % 3 == 1 && j % 3 == 2 || i % 3 == 2 && j % 3 == 0)
        FOR(k, 0, K-1)
          v |= (R[k] > i) << k;
      else if (i % 3 == 0 && j % 3 == 2 || i % 3 == 1 && j % 3 == 0 || i % 3 == 2 && j % 3 == 1)
        FOR(k, 0, K-1)
          v |= (C[k] < j) << k;
      SetFlag(i, j, v + 1);
    }
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;

#define vt vector
#define size(x) (int((x).size()))
#define all(x) begin(x), end(x)

#define REP(a, b, c, d) for (int a = (b); (d) > 0 ? a <= (c) : a >= (c); a += (d))
#define FOR(a, b, c) REP(a, b, c, 1)
#define ROF(a, b, c) REP(a, b, c, -1)

#define chmin(a, b) (a = a < (b) ? a : (b))
#define chmax(a, b) (a = a > (b) ? a : (b))

vt<int> Bruno(int K, vt<int> V) {
  for (int &i : V)
    i--;
  int l0, l1, l2, d0, d1, d2;
  if (V[0] == 128 || V[4] == 128 || V[8] == 128)
    l0 = V[3], l1 = V[7], l2 = V[2], d0 = V[1], d1 = V[5], d2 = V[6];
  else if (V[1] == 128 || V[5] == 128 || V[6] == 128)
    l0 = V[0], l1 = V[4], l2 = V[8], d0 = V[2], d1 = V[3], d2 = V[7];
  else if (V[2] == 128 || V[3] == 128 || V[7] == 128)
    l0 = V[6], l1 = V[1], l2 = V[5], d0 = V[0], d1 = V[4], d2 = V[8];
  vt<int> ret(K, 4);
  FOR(i, 0, K-1) {
    if (l1 & 1 << i)
      ret[i] = 1;
    else if (!(l2 & 1 << i))
      ret[i] = 0;
  }
  FOR(i, 0, K-1) {
    if (d1 & 1 << i)
      ret[i] = 2;
    else if (!(d0 & 1 << i))
      ret[i] = 3;
  }
  return ret;
}

Compilation message (stderr)

Anna.cpp: In function 'void Anna(int, int, std::vector<int>, std::vector<int>)':
Anna.cpp:22:27: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   22 |       else if (i % 3 == 0 && j % 3 == 1 || i % 3 == 1 && j % 3 == 2 || i % 3 == 2 && j % 3 == 0)
      |                ~~~~~~~~~~~^~~~~~~~~~~~~
Anna.cpp:22:83: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   22 |       else if (i % 3 == 0 && j % 3 == 1 || i % 3 == 1 && j % 3 == 2 || i % 3 == 2 && j % 3 == 0)
      |                                                                        ~~~~~~~~~~~^~~~~~~~~~~~~
Anna.cpp:25:27: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   25 |       else if (i % 3 == 0 && j % 3 == 2 || i % 3 == 1 && j % 3 == 0 || i % 3 == 2 && j % 3 == 1)
      |                ~~~~~~~~~~~^~~~~~~~~~~~~
Anna.cpp:25:83: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   25 |       else if (i % 3 == 0 && j % 3 == 2 || i % 3 == 1 && j % 3 == 0 || i % 3 == 2 && j % 3 == 1)
      |                                                                        ~~~~~~~~~~~^~~~~~~~~~~~~

Bruno.cpp: In function 'std::vector<int> Bruno(int, std::vector<int>)':
Bruno.cpp:19:7: warning: variable 'l0' set but not used [-Wunused-but-set-variable]
   19 |   int l0, l1, l2, d0, d1, d2;
      |       ^~
Bruno.cpp:19:27: warning: variable 'd2' set but not used [-Wunused-but-set-variable]
   19 |   int l0, l1, l2, d0, d1, d2;
      |                           ^~
Bruno.cpp:34:12: warning: 'd1' may be used uninitialized in this function [-Wmaybe-uninitialized]
   34 |     if (d1 & 1 << i)
      |         ~~~^~~~~~~~
Bruno.cpp:36:14: warning: 'd0' may be used uninitialized in this function [-Wmaybe-uninitialized]
   36 |     else if (!(d0 & 1 << i))
      |              ^~~~~~~~~~~~~~
Bruno.cpp:30:14: warning: 'l2' may be used uninitialized in this function [-Wmaybe-uninitialized]
   30 |     else if (!(l2 & 1 << i))
      |              ^~~~~~~~~~~~~~
Bruno.cpp:28:12: warning: 'l1' may be used uninitialized in this function [-Wmaybe-uninitialized]
   28 |     if (l1 & 1 << i)
      |         ~~~^~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...