QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#110628#4250. Marsyzy10 0ms0kbC++171.9kb2023-06-03 07:05:322024-04-28 07:16:08

Judging History

你现在查看的是最新测评结果

  • [2024-04-28 07:16:08]
  • 管理员手动重测本题所有提交记录
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-03 07:05:35]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2023-06-03 07:05:32]
  • 提交

answer

#include <bits/stdc++.h>
#include "mars.h"

using namespace std;

using ull = unsigned long long;

#define rep(i, f, t) for (int i = (f), ed##i = (t); i <= ed##i; ++i)

const int N = 44 * 44;

struct UF {
  int fa[N];
  inline void I(int n) {
    rep (i, 0, (2 * n + 1) * (2 * n + 1) - 1) fa[i] = i;
  }
  inline int F(int x) {
    while (x != fa[x]) x = fa[x] = fa[fa[x]];
    return x;
  }
  inline void U(int f, int t) { f = F(f), t = F(t), fa[f] = t; }
} uf;

inline int Id(int x, int y, int n) { return x * (2 * n + 1) + y; }

inline string BinStr(ull y) {
  string s(100, '0');
  rep (i, 0, 63)
    if (y >> i & 1) s[i] = '1';
  return s;
}
inline string BinStr(void *x) { return BinStr(ull(x)); }

inline bitset<N> *StrBin(string s) {
  ull y = 0;
  rep (i, 0, 63)
    if (s[i] == '1') y |= 1ull << i;
  return (bitset<N> *)y;
}

inline int Calc(const bitset<N> &bs, int n) {
  uf.I(n);
  rep (i, 0, 2 * n)
    rep (j, 0, 2 * n - 1)
      if (bs.test(Id(i, j, n)) && bs.test(Id(i, j + 1, n))) uf.U(Id(i, j, n), Id(i, j + 1, n));
  rep (i, 0, 2 * n - 1)
    rep (j, 0, 2 * n)
      if (bs.test(Id(i, j, n)) && bs.test(Id(i + 1, j, n))) uf.U(Id(i, j, n), Id(i + 1, j, n));
  vector<int> vec;
  rep (i, 0, (2 * n + 1) * (2 * n + 1) - 1)
    if (bs.test(i)) vec.push_back(uf.F(i));
  sort(vec.begin(), vec.end());
  return unique(vec.begin(), vec.end()) - vec.begin();
}

inline string Work(vector<vector<string>> a, int x, int y, int k, int n) {
  bitset<N> *bs;
  if (k == 0) {
    bs = new bitset<N>;
    rep (i, 0, 2)
      rep (j, 0, 2)
        if (a[i][j][0] == '1') bs->set(Id(x + i, y + j, n));
  } else {
    bs = StrBin(a[0][0]);
    rep (i, 0, 2)
      rep (j, 0, 2) *bs |= *StrBin(a[i][j]);
  }
  return k == n - 1 ? BinStr(Calc(*bs, n)) : BinStr(bs);
}

string process(vector<vector<string>> a, int i, int j, int k, int n) { return Work(a, i, j, k, n); }

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Instance #0 Runtime Error

Test #1:

score: 0
Instance #0 Runtime Error

input:

224bb858-b13b-5e97-cbba-4a10b0455e79
2
934 389 626 424
1010111000011100001101110100011101000000010110011011101010001010000001011000010011000001111011111111 1101011000101100110110100011110010000010000100001010001110101111010000100001110000001110110011001010 0110111001011000110000110000011011100110001...

output:

f18fba32-f6de-4dd0-ef1b-ea027937a4aa
0000001010011101111111101010111001100111101010100000000000000000000000000000000000000000000000000000
0000001011011101111111101010111001100111101010100000000000000000000000000000000000000000000000000000

input:

224bb858-b13b-5e97-cbba-4a10b0455e79
5
934 390 626 424
1010111000011100001101110100011101000000010110011011101010001010000001011000010011000001111011111111 1101011000101100110110100011110010000010000100001010001110101111010000100001110000001110110011001010 1110111001011000110000110000011011100110001...

output:

f18fba32-f6de-4dd0-ef1b-ea027937a4aa
0000001010011011110111010001011000110000011010100000000000000000000000000000000000000000000000000000
0000001011011011110111010001011000110000011010100000000000000000000000000000000000000000000000000000
0000110100111011110111010001011000110000011010100000000000000...

input:

224bb858-b13b-5e97-cbba-4a10b0455e79
9
935 389 626 424
0010111000011100001101110100011101000000010110011011101010001010000001011000010011000001111011111111 1101011000101100110110100011110010000010000100001010001110101111010000100001110000001110110011001010 1110111001011000110000110000011011100110001...

output:

f18fba32-f6de-4dd0-ef1b-ea027937a4aa
0000001010010011011101001010000111011001101010100000000000000000000000000000000000000000000000000000
0000001011010011011101001010000111011001101010100000000000000000000000000000000000000000000000000000
1100000000000000000000000000000000000000000000000000000000000...

input:

224bb858-b13b-5e97-cbba-4a10b0455e79
9
933 391 626 424
1010111000011100001101110100011101000000010110011011101010001010000001011000010011000001111011111111 0101011000101100110110100011110010000010000100001010001110101111010000100001110000001110110011001010 0110111001011000110000110000011011100110001...

output:

f18fba32-f6de-4dd0-ef1b-ea027937a4aa
0000001010010100011011010000100011010000011010100000000000000000000000000000000000000000000000000000
0000001011010100011011010000100011010000011010100000000000000000000000000000000000000000000000000000
0000110100110100011011010000100011010000011010100000000000000...

input:

224bb858-b13b-5e97-cbba-4a10b0455e79
3
935 391 626 427
1010111000011100001101110100011101000000010110011011101010001010000001011000010011000001111011111111 1101011000101100110110100011110010000010000100001010001110101111010000100001110000001110110011001010 0110111001011000110000110000011011100110001...

output:

f18fba32-f6de-4dd0-ef1b-ea027937a4aa
1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000111011100101100100100011001100001101010100000000000000000000000000000000000000000000000000000
0100000000000000000000000000000000000000000000000000000000000...

input:

224bb858-b13b-5e97-cbba-4a10b0455e79
5
935 391 626 427
0010111000011100001101110100011101000000010110011011101010001010000001011000010011000001111011111111 1101011000101100110110100011110010000010000100001010001110101111010000100001110000001110110011001010 1110111001011000110000110000011011100110001...

output:

f18fba32-f6de-4dd0-ef1b-ea027937a4aa
1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000111010000001001100011001011010011101010100000000000000000000000000000000000000000000000000000
0000111100110000001001100011001011010011101010100000000000000...

input:

224bb858-b13b-5e97-cbba-4a10b0455e79
4
935 391 626 427
0010111000011100001101110100011101000000010110011011101010001010000001011000010011000001111011111111 0101011000101100110110100011110010000010000100001010001110101111010000100001110000001110110011001010 1110111001011000110000110000011011100110001...

output:

f18fba32-f6de-4dd0-ef1b-ea027937a4aa
1100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000111010011001011001100010001000011101010100000000000000000000000000000000000000000000000000000
0000111100110011001011001100010001000011101010100000000000000...

input:

224bb858-b13b-5e97-cbba-4a10b0455e79
5
935 390 626 424
0010111000011100001101110100011101000000010110011011101010001010000001011000010011000001111011111111 0101011000101100110110100011110010000010000100001010001110101111010000100001110000001110110011001010 0110111001011000110000110000011011100110001...

output:

f18fba32-f6de-4dd0-ef1b-ea027937a4aa
0000001010010001111100100100110000001111101010100000000000000000000000000000000000000000000000000000
0000001011010001111100100100110000001111101010100000000000000000000000000000000000000000000000000000
0000110100110001111100100100110000001111101010100000000000000...

result:


Subtask #2:

score: 0
Skipped

Subtask #3:

score: 0
Skipped

Subtask #4:

score: 0
Skipped

Subtask #5:

score: 0
Skipped

Subtask #6:

score: 0
Skipped

Subtask #7:

score: 0
Skipped

Subtask #8:

score: 0
Skipped

Subtask #9:

score: 0
Skipped

Subtask #10:

score: 0
Skipped