제출 #116264

#제출 시각아이디문제언어결과실행 시간메모리
116264emilemTreasure (different grader from official contest) (CEOI13_treasure2)C++14
컴파일 에러
0 ms0 KiB
#include "treasure.h"
#include <vector>
inline int CountTreasures(size_t minI, size_t maxI, size_t minJ, size_t maxJ)
{
	return countTreasure(minI, minJ, maxI, maxJ);
}

void findTreasure(int n)
{
	std::vector< std::vector<int> > sumToClosestCorner(n, std::vector<int>(n));
	for (size_t i = 0; i < n; ++i)
		for (size_t j = 0; j < n; ++j)
		{
			int minI, maxI, minJ, maxJ;
			if (i >= n - i + 1) { minI = 0; maxI = i; }
			else { minI = i; maxI = n; }
			if (j >= n - j + 1) { minJ = 0; maxJ = j; }
			else { minJ = j; maxJ = n; }
			sumToClosestCorner[i][j] = CountTreasures(minI, maxI, minJ, maxJ);
	for (size_t i = 0; i < n; ++i)
		for (size_t j = 0; j < n; ++j)
		{
			int iDir, jDir;
			iDir = (i >= n - i + 1) ? -1 : 1;
			jDir = (j >= n - j + 1) ? -1 : 1;
			int cur = sumToClosestCorner[i][j];
			if (i + iDir >= 0 && i + iDir < n)
				cur -= sumToClosestCorner[i + iDir][j];
			if (j + jDir >= 0 && j + jDir < n)
				cur -= sumToClosestCorner[i][j + jDir];
			if (i + iDir >= 0 && i + iDir < n && j + jDir >= 0 && j + jDir < n)
				cur += sumToClosestCorner[i + iDir][j + jDir];
			if (cur)
				Report(i + 1, j + 1);
		}
}

컴파일 시 표준 에러 (stderr) 메시지

treasure.cpp: In function 'void findTreasure(int)':
treasure.cpp:11:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (size_t i = 0; i < n; ++i)
                     ~~^~~
treasure.cpp:12:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (size_t j = 0; j < n; ++j)
                      ~~^~~
treasure.cpp:20:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (size_t i = 0; i < n; ++i)
                     ~~^~~
treasure.cpp:21:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (size_t j = 0; j < n; ++j)
                      ~~^~~
treasure.cpp:27:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if (i + iDir >= 0 && i + iDir < n)
                         ~~~~~~~~~^~~
treasure.cpp:29:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if (j + jDir >= 0 && j + jDir < n)
                         ~~~~~~~~~^~~
treasure.cpp:31:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if (i + iDir >= 0 && i + iDir < n && j + jDir >= 0 && j + jDir < n)
                         ~~~~~~~~~^~~
treasure.cpp:31:67: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if (i + iDir >= 0 && i + iDir < n && j + jDir >= 0 && j + jDir < n)
                                                          ~~~~~~~~~^~~
treasure.cpp:36:1: error: expected '}' at end of input
 }
 ^