Submission #667888

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

using namespace std;

const int N = 100 + 7;
int s[4][N][N], s2[N][N];
bool deja = 0;
bool ok;
int n;


int get(int type, int r, int c)
{
  if (type == 0)
  {
    if (r <= 0 || c <= 0)
    {
      return 0;
    }
    ok &= (s[type][r][c] != -1);
    return s[type][r][c];
  }
  if (type == 1)
  {
    if (r <= 0 || c > n)
    {
      return 0;
    }
    ok &= (s[type][r][c] != -1);
    return s[type][r][c];
  }

  assert(0);
}

int what(int r, int c)
{
  ok = 1;
  int sm;
  sm = get(0, r, c) - get(0, r - 1, c) - get(0, r, c - 1) + get(0, r - 1, c - 1);

  if (ok)
  {
    return sm;
  }

  ok = 1;
  sm = get(1, r, c) - get(1, r - 1, c) - get(1, r, c + 1) + get(1, r - 1, c + 1);

  if (ok)
  {
    return sm;
  }


  cout << "bad " << r << " " << c << "\n";

  return 0;
 /// assert(0);
}



void findTreasure(int nn)
{
  n = nn;
  for (int k = 0; k < 4; k++)
  {
    for (int i = 0; i < N; i++)
    {
      for (int j = 0; j < N; j++)
      {
        s[k][i][j] = -1;
      }
    }
  }
  assert(deja == 0);
  deja = 1;
  for (int i = 1; i <= n; i++)
  {
    for (int j = 1; j <= n; j++)
    {
      if (j <= n / 2 + 1)
      {
        s[1][i][j] = countTreasure(1, j, i, n);
      }
      if (j >= n / 2 - 1)
      {
        s[0][i][j] = countTreasure(1, 1, i, j);
      }
    }
  }


  for (int i = 1; i <= n; i++)
  {
    for (int j = 1; j <= n; j++)
    {
      if (what(i, j))
      {
        Report(i, j);
      }
    }
  }
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 468 KB Output isn't correct - N = 5, K = 635, score = 0
2 Partially correct 1 ms 468 KB Output is partially correct - N = 10, K = 7960, score = 1
3 Partially correct 1 ms 468 KB Output is partially correct - N = 15, K = 37380, score = 4
4 Partially correct 0 ms 468 KB Output is partially correct - N = 16, K = 47800, score = 4
5 Partially correct 0 ms 468 KB Output is partially correct - N = 55, K = 5992360, score = 4
6 Partially correct 1 ms 468 KB Output is partially correct - N = 66, K = 12328800, score = 4
7 Partially correct 1 ms 468 KB Output is partially correct - N = 77, K = 22718003, score = 4
8 Partially correct 1 ms 468 KB Output is partially correct - N = 88, K = 38592532, score = 4
9 Partially correct 1 ms 468 KB Output is partially correct - N = 99, K = 61622946, score = 4
10 Partially correct 1 ms 468 KB Output is partially correct - N = 100, K = 64130350, score = 4