Submission #667886

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

using namespace std;

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

int pref(int r, int c)
{
  if (r <= 0 || c <= 0)
  {
    return 0;
  }
  if (s1[r][c] == -1)
  {
    ok = 0;
  }
  return s1[r][c];
}

int suf(int r, int c)
{
  if (r > n || c > n)
  {
    return 0;
  }
  if (s2[r][c] == -1)
  {
    ok = 0;
  }
  return s2[r][c];
}

int get(int r, int c)
{
  ok = 1;
  int spref = pref(r, c) - pref(r - 1, c) - pref(r, c - 1) + pref(r - 1, c - 1);

  if (ok)
  {
    return spref;
  }

  ok = 1;

  int ssuf = suf(r, c) - suf(r + 1, c) - suf(r, c + 1) + suf(r + 1, c + 1);

  if (ok)
  {
    return ssuf;
  }

  cout << "bad cell " << r << " " << c << "\n";
  return 0;
}



void findTreasure(int nn)
{
  n = nn;
  for (int i = 0; i < N; i++)
  {
    for (int j = 0; j < N; j++)
    {
      s1[i][j] = s2[i][j] = -1;
    }
  }
  assert(deja == 0);
  deja = 1;
  int sum = n + 1;
  for (int i = 1; i <= n; i++)
  {
    for (int j = 1; j <= n; j++)
    {
      if (i + j <= sum + 2)
      {
        s2[i][j] = countTreasure(i, j, n, n);
      }
      if (i + j >= sum - 2)
      {
        s1[i][j] = countTreasure(1, 1, i, j);
      }
    }
  }
  for (int i = 1; i <= n; i++)
  {
    for (int j = 1; j <= n; j++)
    {
      if (get(i, j))
      {
        Report(i, j);
      }
    }
  }
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct - N = 5, K = 704, score = 0
2 Partially correct 1 ms 340 KB Output is partially correct - N = 10, K = 8914, score = 1
3 Partially correct 0 ms 340 KB Output is partially correct - N = 15, K = 40374, score = 1
4 Partially correct 1 ms 340 KB Output is partially correct - N = 16, K = 51458, score = 1
5 Partially correct 1 ms 340 KB Output is partially correct - N = 55, K = 5906554, score = 4
6 Partially correct 1 ms 340 KB Output is partially correct - N = 66, K = 12055158, score = 4
7 Partially correct 1 ms 340 KB Output is partially correct - N = 77, K = 22076972, score = 4
8 Partially correct 1 ms 340 KB Output is partially correct - N = 88, K = 37332278, score = 4
9 Partially correct 1 ms 340 KB Output is partially correct - N = 99, K = 59386332, score = 4
10 Partially correct 1 ms 340 KB Output is partially correct - N = 100, K = 61787944, score = 4