Submission #414800

# Submission time Handle Problem Language Result Execution time Memory
414800 2021-05-31T08:06:27 Z 장태환(#7553) Navigation 2 (JOI21_navigation2) C++17
Compilation error
0 ms 0 KB
#include "Anna.h"
#include <vector>

namespace {

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

} // namespace

void Anna(int N, int K, std::vector<int> R, std::vector<int> C) 
{
  for (int r = 0; r < N; r++) 
  {
    for (int c = 0; c < N; c++) 
	{
		int f = 0;
		int k;
		int ce= 1;
		for (k = 0; k < K; k++)
		{
			f += ce * ((abs(R[k] - r) + abs(C[k] - c)) % 3);
			ce *= 3;
		}
		SetFlag(r, c, f);
    }
  }
}
#include "Bruno.h"
#include <vector>

namespace {

int variable_example = 1;
int pos[4] = { 5,3,7,1 };
} // namespace

std::vector<int> Bruno(int K, std::vector<int> value) 
{
	std::vector<int>res(K);
	int i;
	for (i = 0; i < K; i++)
	{
		res[i] = 4;
		int j;
		for (j = 0; j < 4; j++)
		{
			if (value[pos[j]]%3 == (value[4] + 2) % 3)
				res[i] = j;
		}
		for (j = 0; j < 9; j++)
		{
			value[j] /= 3;
		}
	}
	return res;
}

Compilation message

Anna.cpp: In function 'void Anna(int, int, std::vector<int>, std::vector<int>)':
Anna.cpp:23:16: error: 'abs' was not declared in this scope
   23 |    f += ce * ((abs(R[k] - r) + abs(C[k] - c)) % 3);
      |                ^~~
Anna.cpp: At global scope:
Anna.cpp:6:5: warning: 'int {anonymous}::FunctionExample(int, int, int)' defined but not used [-Wunused-function]
    6 | int FunctionExample(int r, int c, int K) {
      |     ^~~~~~~~~~~~~~~

Bruno.cpp:6:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    6 | int variable_example = 1;
      |     ^~~~~~~~~~~~~~~~