Submission #667911

# Submission time Handle Problem Language Result Execution time Memory
667911 2022-12-02T11:07:49 Z 600Mihnea Treasure (different grader from official contest) (CEOI13_treasure2) C++17
15 / 100
1 ms 468 KB
#include "treasure.h"
#include <bits/stdc++.h>

using namespace std;

int ask(int r1, int c1, int r2, int c2)
{
  if (r1 > r2 || c1 > c2)
  {
    return 0;
  }
  return countTreasure(r1, c1, r2, c2);
}

const int N = 100 + 7;
int ul[N][N];
int ur[N][N];
int dl[N][N];
int dr[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++)
  {
    if (i <= half + 1)
    {
      for (int j = 1; j <= n; j++)
      {
        dl[i][j] = ask(i, 1, n, j);
      }
    }
    for (int j = 1; j <= n; j++)
    {
      if (j <= half)
      {
        ur[i][j] = ask(1, j, i, n);
      }
      if (half - 1 <= j)
      {
        if (half - 1 <= i)
        {
          ul[i][j] = ask(1, 1, i, j);
        }
      }
    }
  }
  for (int i = 1; i <= n; i++)
  {
    for (int j = 1; j <= half - 1; j++)
    {
      ul[i][j] = ul[i][n] - ur[i][j + 1];
    }
  }
  for (int i = 1; i <= half; i++)
  {
    for (int j = 1; j <= n; j++)
    {
      ul[i][j] = ul[n][j] - dl[i + 1][j];
    ///  assert(ask(1, 1, i, j) + ask(i + 1, 1, n, j) == ask(1, 1, n, j));
    }
  }
  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:23:7: warning: unused variable 'total' [-Wunused-variable]
   23 |   int total = ask(1, 1, n, n);
      |       ^~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct - N = 5, K = 741, score = 0
2 Partially correct 0 ms 340 KB Output is partially correct - N = 10, K = 8984, score = 1
3 Partially correct 1 ms 340 KB Output is partially correct - N = 15, K = 43216, score = 1
4 Partially correct 0 ms 340 KB Output is partially correct - N = 16, K = 54092, score = 1
5 Partially correct 1 ms 340 KB Output is partially correct - N = 55, K = 6997116, score = 1
6 Partially correct 1 ms 340 KB Output is partially correct - N = 66, K = 14293492, score = 1
7 Partially correct 1 ms 340 KB Output is partially correct - N = 77, K = 26570505, score = 1
8 Partially correct 1 ms 468 KB Output is partially correct - N = 88, K = 44880356, score = 4
9 Partially correct 1 ms 468 KB Output is partially correct - N = 99, K = 72142075, score = 1
10 Partially correct 1 ms 468 KB Output is partially correct - N = 100, K = 74664929, score = 4