Submission #435708

# Submission time Handle Problem Language Result Execution time Memory
435708 2021-06-23T15:21:06 Z Kevin_Zhang_TW Navigation 2 (JOI21_navigation2) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pb emplace_back
#define AI(i) begin(i), end(i)
template<class T> bool chmin(T &a, T b) { return b < a && (a = b, true); }
template<class T> bool chmax(T &a, T b) { return a < b && (a = b, true); }
#ifdef KEV
#define DE(args...) kout("[ " + string(#args) + " ] = ", args)
void kout() { cerr << endl; }
template<class T, class ...U> void kout(T a, U ...b) { cerr << a << ' ', kout(b...); }
template<class T> void debug(T l, T r) { while (l != r) cerr << *l << " \n"[next(l)==r], ++l; }
#else
#define DE(...) 0
#define debug(...) 0
#endif
#include "Anna.h"
#include <vector>

namespace {

const int MAX_N = 200;

int res[MAX_N][MAX_N];

} // namespace

void Anna(int N, int K, std::vector<int> R, std::vector<int> C) { 

	for (int i = 0;i < N;++i) for (int j = 0;j < N;++j) {
		res[i][j] = 0;

		int A = 0, B = 0;

		if (j % 3==0) A |= 1<<3;

		int h = j % 3 * 3;

		for (int l = h;l < h+3 && l < K;++l) {
			if (R[l] <= i) A |= 1<<(l-h);
		}

		if (i % 3==0) B |= 1<<3;

		h = i % 3 * 3;

		for (int l = h;l < h+3 && l < K;++l) {
			if (C[l] >= j) B |= 1<<(l-h);
		}

//		for (int l = 0;l < K;++l) {
//			if (R[l] <= i) res[i][j] |= 1<<l;
//			if (C[l] >= j) res[i][j] |= 1<<(l+K);
//		}

		DE(A, B);
		res[i][j] = A + (B << 4) + 1;
	}

	for (int r = 0; r < N; r++) {
		for (int c = 0; c < N; c++) {
			SetFlag(r, c, res[r][c]);
		}
	}
	cerr << "Done" << endl;
}
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pb emplace_back
#define AI(i) begin(i), end(i)
template<class T> bool chmin(T &a, T b) { return b < a && (a = b, true); }
template<class T> bool chmax(T &a, T b) { return a < b && (a = b, true); }
#ifdef KEV
#define DE(args...) kout("[ " + string(#args) + " ] = ", args)
namespace {
void kout() { cerr << endl; }
template<class T, class ...U> void kout(T a, U ...b) { cerr << a << ' ', kout(b...); }
template<class T> void debug(T l, T r) { while (l != r) cerr << *l << " \n"[next(l)==r], ++l; }
#else
#define DE(...) 0
#define debug(...) 0
#endif
}

const int MAX_N = 300010;
#include "Bruno.h"
#include <vector>

namespace {

} // namespace

int get(int s, int a, int b, int c) {
	DE(a, b, c);
	a >>= s, b >>= s, c >>= s;
	a &= 0b1111;
	b &= 0b1111;
	c &= 0b1111;
	while (~a&(1<<3)) {
		tie(a, b, c) = make_tuple(b, c, a);
	} 
	a ^= (1<<3);
	return (a | (b<<3) | (c<<6)); 
}
std::vector<int> Bruno(int K, std::vector<int> value) {
  std::vector<int> res(K, 0);
  for (int &i : value) --i;

  int u0 = get(0,value[3], value[4], value[5]),
	  u1 = get(0,value[0], value[1], value[2]),
	  v0 = get(4,value[1], value[4], value[7]),
	  v1 = get(4,value[2], value[5], value[8]);
  DE(u0, u1, v0, v1);

  for (int i = 0; i < K; i++) {
	  if (u1&(1<<i)) 
		  res[i] = 3;
	  else if (v1&(1<<i))
		  res[i] = 0;
	  else if (~u0&(1<<i))
		  res[i] = 2;
	  else if (~v0&(1<<i))
		  res[i] = 1;
	  else res[i] = 4;
  }

//	  if (value[1] & (1<<i)) {
//		  res[i] = 3;
//	  } else if (value[5] & (1<<(i+K))) {
//		  res[i] = 0;
//	  } else if (~value[4] & (1<<i)) {
//		  res[i] = 2;
//	  } else if (~value[4] & (1<<(i+K))) {
//		  res[i] = 1;
//	  } else res[i] = 4; 
  
  return res;
}

Compilation message

Anna.cpp: In function 'void Anna(int, int, std::vector<int>, std::vector<int>)':
Anna.cpp:14:17: warning: statement has no effect [-Wunused-value]
   14 | #define DE(...) 0
      |                 ^
Anna.cpp:56:3: note: in expansion of macro 'DE'
   56 |   DE(A, B);
      |   ^~

Bruno.cpp:18:1: error: expected declaration before '}' token
   18 | }
      | ^
Bruno.cpp: In function 'int get(int, int, int, int)':
Bruno.cpp:15:17: warning: statement has no effect [-Wunused-value]
   15 | #define DE(...) 0
      |                 ^
Bruno.cpp:29:2: note: in expansion of macro 'DE'
   29 |  DE(a, b, c);
      |  ^~
Bruno.cpp: In function 'std::vector<int> Bruno(int, std::vector<int>)':
Bruno.cpp:15:17: warning: statement has no effect [-Wunused-value]
   15 | #define DE(...) 0
      |                 ^
Bruno.cpp:48:3: note: in expansion of macro 'DE'
   48 |   DE(u0, u1, v0, v1);
      |   ^~