UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#179830#8. 小w、小j和小zmH0374ms41756kbC++111.6kb2023-08-04 09:55:162023-08-04 09:55:17

answer

#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = 1000003, maxn = 1e9 + 1;
int h, z, n, ggg, pos[2], ans[10], x[100005], y[100005], head[2][1000003];
struct node
{
  int v, w, next;
} e[2][1000003];
int get(int key)
{
  return key % MOD;
}
void insert(bool f, int key, int w)
{
  int idx = get(key);
  e[f][++pos[f]] = {key, w, head[f][idx]};
  head[f][idx] = pos[f];
}
int find(bool f, int key)
{
  int idx = get(key);
  for (int i = head[f][idx]; i; i = e[f][i].next)
    if (e[f][i].v == key)
      return e[f][i].w;
  return 0;
}
int get(int x1, int y1)
{
  int sum = 0;
  for (int j = 0; j < 3; j++)
    for (int k = 0; k < 3; k++)
      sum += find(0, (x1 + j) * maxn + y1 + k);
  return sum;
}
signed main()
{
#ifndef ONLINE_JUDGE
  freopen("data/data.in", "r", stdin);
// freopen("data/data.out", "w", stdout);
#endif
  srand(time(0ll));
  std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  h = 10000, z = 10000, n = 100000;
  for (int i = 1; i <= n; i++)
    x[i] = rand() % 10000 + 1, y[i] = rand() % 10000 + 1, insert(0, x[i] * maxn + y[i], 1);
  for (int i = 1; i <= n; i++)
    for (int j = 0; j < 3; j++)
      for (int k = 0; k < 3; k++)
        if (x[i] - j >= 1 && y[i] - k >= 1 && x[i] - j + 2 <= h && y[i] - k + 2 <= z && !find(1, (x[i] - j) * maxn + y[i] - k))
          insert(1, (x[i] - j) * maxn + y[i] - k, 1), ans[get(x[i] - j, y[i] - k)]++;
  for (int i = 1; i <= 9; i++)
    ggg += ans[i];
  cout << (h - 2) * (z - 2) - ggg << '\n';
  for (int i = 1; i <= 9; i++)
    cout << ans[i] << '\n';
  exit(0);
}

详细

小提示:点击横条可展开更详细的信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 119ms
memory: 41748kb

input:

20 10
-715624307 -28629151
957936621 17210368
-753657459 59049
-40974960 5153632
-402454312 -3450252...

output:

99064357
892013
3632
2
0
0
0
0
0
0

result:

wrong answer expected 11.3999000000, found 99064357.0000000000

Subtask #2:

score: 0
Wrong Answer

Test #6:

score: 0
Wrong Answer
time: 125ms
memory: 41756kb

input:

200 10
-487405787 3200000
725249085 28629151
-671026855 -4084101
38046635 45435424
-188495128 643634...

output:

99064238
892312
3445
9
0
0
0
0
0
0

result:

wrong answer expected 0.0039000000, found 99064238.0000000000

Subtask #3:

score: 0
Skipped

Subtask #4:

score: 0
Wrong Answer

Test #18:

score: 0
Wrong Answer
time: 130ms
memory: 41752kb

input:

2000 10
882856800 -387420489
866607093 -134217728
481381898 1
-488180557 1953125
-783185249 -19683
-...

output:

99064238
892312
3445
9
0
0
0
0
0
0

result:

wrong answer expected 0.0001000000, found 99064238.0000000000

Subtask #5:

score: 0
Skipped

Subtask #6:

score: 0
Skipped