QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#579090#3319. RanksJWRuixiAC ✓19ms5052kbC++202.0kb2024-09-21 08:39:372024-09-21 08:39:38

Judging History

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

  • [2024-09-21 08:39:38]
  • 评测
  • 测评结果:AC
  • 用时:19ms
  • 内存:5052kb
  • [2024-09-21 08:39:37]
  • 提交

answer

#ifdef LOCAL
#include "stdafx.h"
#else
#include <bits/stdc++.h>
#define IL inline
#define LL long long
#define eb emplace_back
#define sz(v) ((int) (v).size())
#define L(i, j, k) for (int i = (j); i <= (k); ++i)
#define R(i, j, k) for (int i = (j); i >= (k); --i)
#define FIO(FILE) freopen(FILE".in", "r", stdin), freopen(FILE".out", "w", stdout)
using namespace std;

using vi = vector<int>;
#endif

constexpr int N = 1e3 + 9;
int n, m, p[N], R[N];
char S[N], A[N][N];

using vec = bitset<N>;

vec a[N], b[N], c[N];

bool can[N], key[N], alt[N], oo[N];

int main () {
  ios::sync_with_stdio(0), cin.tie(0);
  cin >> n >> m;
  L (i, 0, n - 1) {
    cin >> S;
    L (j, 0, m - 1) {
      a[i].set(j, S[j] == '1');
    }
  }
  L (i, 0, n - 1) {
    b[i] = a[i];
    c[i].set(i);
    p[i] = i;
    R[i] = -1;
  } 
  int cur = 0;
  L (r, 0, m - 1) {
    int t = -1;
    L (i, cur, n - 1) {
      if (b[i].test(r)) {
        t = i;
        break;
      }
    }
    if (t == -1) {
      continue;
    }
    swap(b[cur], b[t]);
    swap(p[cur], p[t]);
    R[p[cur]] = r;
    L (i, 0, n - 1) {
      if ((i ^ cur) && b[i].test(r)) {
        b[i] ^= b[cur];
        c[p[i]] ^= c[p[cur]];
      }
    }
    ++cur;
  }
  L (i, 0, cur - 1) {
    int t = p[i];
    key[R[t]] = true;
    if (b[i]._Find_next(R[t]) >= m) {
      can[R[t]] = true;
    }
  }
  L (i, 0, n - 1) {
    if (R[i] == -1) {
      for (int k = c[i]._Find_first(); k < n; k = c[i]._Find_next(k)) {
        alt[k] = true;
      }
    }
  }
  L (i, 0, n - 1) {
    if (alt[i]) {
      L (j, 0, m - 1) {
        if (key[j]) {
          A[i][j] = can[j] ? '0' : '+';
        } else {
          A[i][j] = '+';
        }
      }
    } else {
      L (j, 0, m - 1) {
        A[i][j] = '0';
      }
      L (j, 0, cur - 1) {
        int t = p[j];
        if (c[t].test(i) && can[R[t]]) {
          A[i][R[t]] = '-';
        }
      }
    }
  }
  L (i, 0, n - 1) {
    cout << A[i] << '\n';
  }
}
// I love WHQ!

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3660kb

input:

31 31
1110011010000110001010001110010
1111101001010000001110110100110
1110011010000110001010001110010
1110100110111011111111010101101
0101110000101111011000110101111
1110011010000110001010001110010
0101111111100100011010101111110
1110100110111011111111010101101
1001100011100101111110001101001
010111...

output:

+++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++
0000000000000000000000000000000
+++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++
0000000000000000000000000000000
++++++++++++...

result:

ok 31 lines

Test #2:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

26 26
10010011100011000110001111
00000000000000000000000000
11001111100101110110010010
11100111110101111010101100
11001111100101110110010010
11001111100101110110010010
11001111011010111000011010
01111110011110111010100100
11001111011010111000011010
11001111100101110110010010
110011110110101110000110...

output:

00000000000000000000000000
++++++++++++++++++++++++++
++++++++++++++++++++++++++
00000000000000000000000000
++++++++++++++++++++++++++
++++++++++++++++++++++++++
++++++++++++++++++++++++++
00000000000000000000000000
++++++++++++++++++++++++++
++++++++++++++++++++++++++
++++++++++++++++++++++++++
+++...

result:

ok 26 lines

Test #3:

score: 0
Accepted
time: 3ms
memory: 4520kb

input:

633 633
0110111110111110010011001111000111111111010111010101111001001111011011111111011000101111101011011011011010100100101101100010100000111110100101010000111011110110101010100111000011100010111111001111110101011101111101100110101110001001101111110001101110011101001000111001100011000111101101111000...

output:

+++++0++++++++++++++++++++++++++++++++++++++++0+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++0++0+++0+++++++++++++++++0++++++++++++++000+++++0+++++0+++++++++++++++++++++++++++++++++++0+++0+++++++++++++++++++++++++++++++++++++++++++++++++++++++0+++++++++++++++++++++++++++++...

result:

ok 633 lines

Test #4:

score: 0
Accepted
time: 5ms
memory: 4964kb

input:

903 903
1110101101100001010010111101110100110111101011111100001000001110011101100101100000011111101111010101100111100000001011001100100001100110101010101011100001110100001000001111011100111111000001011000100100101001001011000001000011110100111011010011011001100000100001110101101100101100101111101100...

output:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...

result:

ok 903 lines

Test #5:

score: 0
Accepted
time: 6ms
memory: 4932kb

input:

973 973
1101011110110110111001111100111010010111111110111001111110111001000101001110011111001011001111010010110110100100101011001111100011100010101010100111101100110101100000010001101100100001101011100110000010000011111010010111011011101000101000111011101100000010111001001010000010111010010001110100...

output:

+++++++++0++++++++++++++++0++++0+++++0+++++++0++++++++++++++++++++++++++0++00+++++++++++++++++++++++0+++++++++++++++++++++++0+++++++0+++++0+++++0+0++++++++++++++++++++++++++0+++++++0+++++0++++++++++++++++++++0+++++++++++++++++0+++++0+++++00++++++++++++++++0++0+++++++++++++++++++++++0+++++++++++0++++...

result:

ok 973 lines

Test #6:

score: 0
Accepted
time: 0ms
memory: 3728kb

input:

1 1
1

output:

-

result:

ok single line: '-'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

2 2
11
10

output:

0-
--

result:

ok 2 lines

Test #8:

score: 0
Accepted
time: 0ms
memory: 3740kb

input:

3 3
011
101
111

output:

-0-
0--
---

result:

ok 3 lines

Test #9:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

9 9
011111101
001110110
000001101
100101010
000011110
011001110
111010001
011011100
101111000

output:

000-0--00
0-00----0
--0------
0--00--00
000--0---
00--00---
--00-00-0
-0-0--00-
00-0----0

result:

ok 9 lines

Test #10:

score: 0
Accepted
time: 0ms
memory: 3852kb

input:

133 133
1111110110000100010110100010001010000111000000010011011111101010110111001001010101110100001100000011100011000101100111110000101110111
0011001111011101111001100010010100000000110100010011100111100010111001001111010101110100001110101100000101011111100111010001111001101
011110000101111100000011...

output:

----0000-0--00-000--000-0-0--0--0--0-0000-0--0--0-000--0000--00-00--00-0--0000000----00--0-0----0-0--00-------000-0------00-00000--0-
0-0-00-0-000---00-0--00--------000---0000--00-00---000----0--0-0-00000--0-0----0-0000-00------00---0000--0-----000000-----0--0-0-0-00
0-0000-0-00000-0-0--00--000-0--0...

result:

ok 133 lines

Test #11:

score: 0
Accepted
time: 7ms
memory: 4484kb

input:

581 581
0011111101010100110000100111011101011100011011111100111000000000100001101010111011000011100000110110011101010001100011010110000100101000000110010100100101100011110111110100010110110010000011110010001011001111101101101001010100011110110011000011100011100101101100011011111010011111100101100011...

output:

--00-0000--00-0000000---0-000-0000-00-0--0--0-00-0000--0-00--0000-0---0000----0000-000--0--0000---00-0-0---0-0--0-0000-0-0-----00-00-------0-00-0---0-0------0----000-00--0----0--000---0--000-0--00-0-0-00-000---0-0-0-0-000000---0-0-0-0---0-00-------0-000000---0-00--------0000-000----0000-0-000-0-----...

result:

ok 581 lines

Test #12:

score: 0
Accepted
time: 15ms
memory: 5052kb

input:

999 999
1100100000101010010100110110010000010110000001101110111110010101101111010011101110010001101001101000111010101011001000101111100110011110100101100100100111111011001001010101001000001110101001001101010001010000010010011011101011101001000011101011001011010111000100011110000000010010100000011110...

output:

0-00--00-----000---0-00-0-0-----000--00-0-00000-000---0---------0000--0----0--0000--00--0--0-00--0000----0000-0-0-0000000---0-0---------0---000---0-00-0---0-0--000----0----000-0---0-0--0--0-00000-00-000--0-00---0-0---00-0---0--0-00-0-00---00-00-000-00-000-00000-00000--000-----0-0-00--000---00-0-0000...

result:

ok 999 lines

Test #13:

score: 0
Accepted
time: 15ms
memory: 5028kb

input:

1000 1000
01000110001100011111111010010111100011010011000011001001001010000100001001100100101011101001101111101010001110110011000000001010111001011111001010110000010111111110100101011000001010001110100010010011110000000001010011001110000001001010010101101100001010110011011010011101100001011100011111...

output:

-0-00-00-0----0-0--0-00-00--000-0--0000-00--0--------0-00--0-000-00---0000-0--00-00--00--000-00---000000-0-----0-0----00--0-----00000---000-0--0-0--000-0-0-000-----00-000--00-0000-000--000-0-00--00------0-0-0-00-00-0-0-0---00--00-0-0000---0-000000----------00--0-0--0---0-00-----00-0-0--0-0-----0--0-...

result:

ok 1000 lines

Test #14:

score: 0
Accepted
time: 19ms
memory: 4972kb

input:

1000 1000
00010011010001010110000111110110010110010110001000000101111000010100111001010110010101001011110101000100001010101010001001010100101110100010101101101110000010001000010010001100011010111011111000111010101110101001010101100110000001011110010111111101101100101010110100010110100000111010000101...

output:

-0-000000----00000-0-0000--00000---0-0-0-0---0-000-0-000----0-0-00-0000--0--00-0-0--0--0----0--0000000-0--0---0-0-00---00--00-0-0-0000--0-00-0-0-0------00-0000--0-00000000-0---00-00----000-0---00--00---0-------0--000---0--0-00-0---0------0-00-000-0-00--00----0-0--0---0--000-0---0-0000-000-00-00-0---...

result:

ok 1000 lines

Test #15:

score: 0
Accepted
time: 19ms
memory: 5028kb

input:

1000 1000
00101001010100101000110001011111100001111001110100001100001101101101110110100011011100000011000100101011000101111101011101010100010000010111100110111101000100111010010011000000000111010111101110101000010011111010101101101100000011011001111101100101001101010111001110000101100000110110010100...

output:

-----00-000----00-0---0-00000-000----0-00-0-0----00----00--00-0-0--0-0----0000----0-----00-0-0000----000-0--00-0-000--0-00---0--0-0-000-000000-00-0--000-000-0--0-0-00---0--00000--000-000--0-0----0-0--0-000--0--0-00-0--000000---0---0-000---0-0000-0--0-0-0--00-------0--0000--00--000-0---0000--0----000...

result:

ok 1000 lines

Test #16:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

10 9
011010011
000111101
011110100
110001100
011101011
101101101
010111001
110100010
100101101
011010011

output:

000000000
0-00--0--
-000--0-0
--0--0---
-00---00-
---0---0-
000-0----
0-0000-0-
----0----
000000000

result:

ok 10 lines

Test #17:

score: 0
Accepted
time: 0ms
memory: 3696kb

input:

10 8
00110010
01010011
01001101
00101001
00111010
01001111
10111001
10000101
00101001
01001101

output:

-00--00-
----000-
00000000
00000000
0-00--0-
00-00---
00--0-0-
-0--0-0-
00000000
00000000

result:

ok 10 lines

Test #18:

score: 0
Accepted
time: 0ms
memory: 3680kb

input:

7 10
0101100110
0100111111
1110110111
0100101111
0100110001
1111110001
1110100000

output:

000-00-00-
00000--00-
000-00000-
00000-000-
000-00000-
000000-00-
000-00-000

result:

ok 7 lines

Test #19:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

9 5
01111
01111
11000
00111
00001
10101
00001
00111
10101

output:

00000
00000
-0--0
00000
00000
00000
00000
00000
00000

result:

ok 9 lines

Test #20:

score: 0
Accepted
time: 0ms
memory: 3696kb

input:

5 10
1100101000
1010110110
0010010110
0101001001
0101011101

output:

0000000000
0000000000
0000000000
0000000000
0000000000

result:

ok 5 lines

Test #21:

score: 0
Accepted
time: 1ms
memory: 3760kb

input:

100 199
0110001111000101101011011010001101011000110101110110101100011100101111000001001111101000100110111011100110101011111111010001111000010001101101110110100000100001010100011000101011001110101110100100110
01110001101001000000011110000100101000000100110100000100001110001001010110110000001000001010...

output:

00000000000000000000000000000000000000000000000000000000000000000000000000000000000000-0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 100 lines

Test #22:

score: 0
Accepted
time: 14ms
memory: 4952kb

input:

999 1000
110011011101110101101110001110001001010010111000111010101111101000010101001110111000111101010100111001110111001000010111100111000100111010111100000111010000101011001010111011111000110101000000011110100100111100000000101100010110111100000010000101011010111101010001100011110111010100001010000...

output:

0--00--000000--0--0--0---00---0000--0-0--00-0--0--0-0--000-0--00---0-0-000-00----00---00-0000000000-0000----00--0---00-00--00-0-0---0----0-00-000----0-0----00--0--00-0--000-00000000000--0-0-000---00000---00-0-0-----0---0--0000----00-0--0---0-00--00---00--000-0000---00-0-0000--0-0-0-0--00--0-0-00-000...

result:

ok 999 lines

Test #23:

score: 0
Accepted
time: 16ms
memory: 5044kb

input:

1000 900
110000100110010011000101100001010100110000111101010110001100100010110110001111011001101101010011000000000100000100001010111000000101000101110110010101100010010100001111100001011100110001010010101100001110011001110010111101000010010101001111010110000011110000110101101001110000001010100111100...

output:

0--00--0000-0-0--0---000--0000--000--0--00-0-0-0-0000-00-000-000---00--00-0---0-0-0---00--00----0-0000-0-0---0-0-00-0--0-0-0--0-0000-00-00--00-00-00-0-0----0--0-000-0-0--0--000000------0---0-00000-0--0-000---0-0-0-0-00--0--000-0-000-0-0-0--0-00-000-00--00----0---00---00---0---0-00----00--00--------0...

result:

ok 1000 lines

Test #24:

score: 0
Accepted
time: 3ms
memory: 4300kb

input:

500 980
0111001100011100111101000000111101010110101110100101100100001001111110001000010101110010001111100000000111110100101101111000110011100010010100011100101111001110100010000010010011010101101111100001000101110000101111111011000001111101101110010110100011000001010011000111111110011010111101011010...

output:

000000000000000000000000000000000000000000000-00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 500 lines

Test #25:

score: 0
Accepted
time: 3ms
memory: 4288kb

input:

500 990
0010100100100100111001001001111110001011011100101100010001001110101101100011010001110101011001100001111100100101101100100010011111110011011001110010010010011100011100011000011111011101110011010000010001001001000000011000011001100101011111110011100101110101010001011110100010101001100101110010...

output:

00000000000000000000000-00000000000000000000-0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000-0000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 500 lines

Test #26:

score: 0
Accepted
time: 6ms
memory: 4352kb

input:

500 1000
100101110010110000111111001101001000101111101101101011101110000110111100101111111010010001011110100001100011100000111101001010100011011101111101001100101101110110110000110111011001111111101011100000101010001101101010110100001111110001000101100100110000111000001100000010010000100011000001011...

output:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 500 lines

Test #27:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

1 1
0

output:

+

result:

ok single line: '+'

Test #28:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

2 3
000
000

output:

+++
+++

result:

ok 2 lines

Test #29:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

1 1000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...

result:

ok single line: '++++++++++++++++++++++++++++++...+++++++++++++++++++++++++++++++'