답안 #667910

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
667910 2022-12-02T11:00:51 Z 600Mihnea 보물 찾기 (CEOI13_treasure2) C++17
44 / 100
1 ms 340 KB
#include "treasure.h"
#include <bits/stdc++.h>

using namespace std;

int ask(int r1, int c1, int r2, int c2)
{
  return countTreasure(r1, c1, r2, c2);
}

const int N = 100 + 7;
int ul[N][N];
int ur[N][N];

void findTreasure(int n)
{
  int total = ask(1, 1, n, n);
  int half = (n + 1) / 2;
  for (int i = 1; i <= n; i++)
  {
    for (int j = 1; j <= n; j++)
    {
      if (j <= half + 1)
      {
        ur[i][j] = ask(1, j, i, n);
      }
      if (half <= j)
      {
        ul[i][j] = ask(1, 1, i, j);
      }
    }
  }
  for (int i = 1; i <= n; i++)
  {
    for (int j = 1; j <= half; j++)
    {
      ul[i][j] = ul[i][n] - ur[i][j + 1];
    }
  }
  for (int i = 1; i <= n; i++)
  {
    for (int  j = 1; j <= n; j++)
    {
      int val_ij = ul[i][j] - ul[i - 1][j] - ul[i][j - 1] + ul[i - 1][j - 1];
      if (val_ij)
      {
        Report(i, j);
      }
    }
  }
}

Compilation message

treasure.cpp: In function 'void findTreasure(int)':
treasure.cpp:17:7: warning: unused variable 'total' [-Wunused-variable]
   17 |   int total = ask(1, 1, n, n);
      |       ^~~~~
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 212 KB Output is partially correct - N = 5, K = 521, score = 8
2 Partially correct 0 ms 212 KB Output is partially correct - N = 10, K = 7171, score = 4
3 Partially correct 0 ms 340 KB Output is partially correct - N = 15, K = 34711, score = 4
4 Partially correct 0 ms 340 KB Output is partially correct - N = 16, K = 44641, score = 4
5 Partially correct 0 ms 340 KB Output is partially correct - N = 55, K = 5865971, score = 4
6 Partially correct 0 ms 340 KB Output is partially correct - N = 66, K = 12111991, score = 4
7 Partially correct 0 ms 340 KB Output is partially correct - N = 77, K = 22372505, score = 4
8 Partially correct 0 ms 340 KB Output is partially correct - N = 88, K = 38079361, score = 4
9 Partially correct 1 ms 340 KB Output is partially correct - N = 99, K = 60890149, score = 4
10 Partially correct 1 ms 340 KB Output is partially correct - N = 100, K = 63377701, score = 4