QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#809377#8892. Power GridMax_s_xaM0 128ms266652kbC++174.8kb2024-12-11 14:41:112024-12-11 14:41:17

Judging History

This is the latest submission verdict.

  • [2024-12-11 14:41:17]
  • Judged
  • Verdict: 0
  • Time: 128ms
  • Memory: 266652kb
  • [2024-12-11 14:41:11]
  • Submitted

answer

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <random>
#include <ctime>
#include <chrono>
#include <numeric>
#include <iomanip>
#include <cassert>

typedef long long ll;
typedef double lf;
typedef unsigned long long ull;

// #define DEBUG 1
struct IO
{
    #define MAXSIZE (1 << 20)
    #define isdigit(x) (x >= '0' && x <= '9')
    char buf[MAXSIZE], *p1, *p2;
    char pbuf[MAXSIZE], *pp;
    #if DEBUG
    #else
    IO() : p1(buf), p2(buf), pp(pbuf) {}
    ~IO() {fwrite(pbuf, 1, pp - pbuf, stdout);}
    #endif
    #define gc() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, MAXSIZE, stdin), p1 == p2) ? ' ' : *p1++)
    #define blank(x) (x == ' ' || x == '\n' || x == '\r' || x == '\t')

    template <typename T>
    void Read(T &x)
    {
        #if DEBUG
        std::cin >> x;
        #else
        bool sign = 0; char ch = gc(); x = 0;
        for (; !isdigit(ch); ch = gc())
            if (ch == '-') sign = 1;
        for (; isdigit(ch); ch = gc()) x = x * 10 + (ch ^ 48);
        if (sign) x = -x;
        #endif
    }
    void Read(char *s)
    {
        #if DEBUG
        std::cin >> s;
        #else
        char ch = gc();
        for (; blank(ch); ch = gc());
        for (; !blank(ch); ch = gc()) *s++ = ch;
        *s = 0;
        #endif
    }
    void Read(char &c) {for (c = gc(); blank(c); c = gc());}

    void Push(const char &c)
    {
        #if DEBUG
        putchar(c);
        #else
        if (pp - pbuf == MAXSIZE) fwrite(pbuf, 1, MAXSIZE, stdout), pp = pbuf;
        *pp++ = c;
        #endif
    }
    template <typename T>
    void Write(T x)
    {
        if (x < 0) x = -x, Push('-');
        static T sta[35];
        int top = 0;
        do sta[top++] = x % 10, x /= 10; while (x);
        while (top) Push(sta[--top] ^ 48);
    }
    template <typename T>
    void Write(T x, char lst) {Write(x), Push(lst);}
} IO;
#define Read(x) IO.Read(x)
#define Write(x, y) IO.Write(x, y)
#define Put(x) IO.Push(x)

using namespace std;

const int MAXN = 1010, MAXM = 2e6 + 10;

int n, m;
ll c[MAXN][MAXN], ans[MAXN][MAXN];

bool Tr;
inline void Swap()
{
    Tr = 1;
    int mx = max(n, m);
    for (int i = 1; i <= mx; i++)
        for (int j = 1; j < i; j++)
            swap(c[i][j], c[j][i]);
    swap(n, m);
}
inline void Print()
{
    if (Tr) Swap();
    for (int i = 1; i <= n; i++, cout << '\n')
        for (int j = 1; j <= m; j++)
            cout << ans[i][j] << ' ';
}

ll a[MAXN], b[MAXN];
inline void Trans()
{
    ll sum0 = 0, sum1 = 0;
    for (int i = 2; i < n; i++) ans[i][1] = a[i], sum0 += a[i];
    for (int i = 2; i < m; i++) ans[1][i] = b[i], sum1 += b[i];
    ans[1][m] = a[1] - sum1, ans[n][1] = b[1] - sum0, ans[n][m] = b[m] - ans[1][m];
}
vector <pair <int, int>> op;
bitset <MAXM> f[MAXN];
inline bool Solve(int p, int q)
{
    int t = abs(n - m), sum = 0;
    for (int i = 1; i <= m; i++) b[i] = -c[p][i], sum -= b[i];
    op.clear(), a[p] = 0;
    for (int i = 1; i <= n; i++)
    {
        if (i == p) continue;
        int lx = b[q] - c[i][q], rx = b[q] + c[i][q];
        bool fl = (lx <= 0), fr = (rx <= 0);
        for (int j = 1; j <= m; j++)
            fl &= (abs(lx - b[j]) == c[i][j]), fr &= (abs(rx - b[j]) == c[i][j]);
        if (!fl && !fr) return 0;
        if (!fr) a[i] = lx;
        else if (!fl) a[i] = rx;
        else a[i] = lx, op.emplace_back(rx - lx, i);
        sum += a[i];
    }
    int tot = op.size();
    f[0].reset(), f[0].set(0);
    for (int i = 1; i <= tot; i++) f[i] = f[i - 1], f[i] |= (f[i - 1] << op[i - 1].first);
    int x;
    if (!t) x = -sum;
    else
    {
        for (x = (-sum % t + t) % t; x < MAXM; x += t)
            if (f[tot][x]) break;
        if (x >= MAXM) x = -1;
    }
    if (x < 0 || !f[tot][x]) return 0;
    for (int i = tot; i >= 1; i--)
        if (!f[i - 1][x]) a[op[i].second] += op[i].first, x -= op[i].first;
    if (n != m)
    {
        int sum0 = accumulate(a + 1, a + n + 1, 0), sum1 = accumulate(b + 1, b + m + 1, 0);
        int tt = (sum0 - sum1) / (m - n);
        for (int i = 1; i <= n; i++) a[i] += tt;
        for (int i = 1; i <= m; i++) b[i] += tt;
    }
    return Trans(), 1;
}

int main()
{
    // freopen("D.in", "r", stdin);
    // freopen("D.out", "w", stdout);
    #if DEBUG
    #else
    ios::sync_with_stdio(0), cin.tie(0);
    #endif
    Read(n), Read(m);
    int p = -1, q = -1, mx = 0;
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++)
        {
            Read(c[i][j]);
            if (mx < c[i][j]) mx = c[i][j], p = i, q = j;
        }
    if (Solve(p, q)) Print();
    else Swap(), Solve(q, p), Print();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 8
Accepted
time: 2ms
memory: 10764kb

input:

1 1
0

output:

0 

result:

ok correct

Test #2:

score: 8
Accepted
time: 0ms
memory: 10812kb

input:

1 1
0

output:

0 

result:

ok correct

Test #3:

score: 8
Accepted
time: 1ms
memory: 12280kb

input:

1 2
1 1

output:

1 -1 

result:

ok correct

Test #4:

score: 0
Wrong Answer
time: 1ms
memory: 10952kb

input:

3 1
0
3
1

output:

-1 
2 
0 

result:

wrong answer Rowsum 1 and columnsum 1 did not correspond to C

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Wrong Answer

Test #23:

score: 11
Accepted
time: 1ms
memory: 10700kb

input:

1 1
0

output:

0 

result:

ok correct

Test #24:

score: 0
Wrong Answer
time: 1ms
memory: 10560kb

input:

1 10
230 289 918 752 224 184 573 217 398 715

output:

270 211 -418 -252 276 316 -73 283 102 -270 

result:

wrong answer Rowsum 1 and columnsum 1 did not correspond to C

Subtask #4:

score: 0
Wrong Answer

Test #30:

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

input:

2 2
0 0
0 0

output:

0 0 
0 0 

result:

ok correct

Test #31:

score: 6
Accepted
time: 1ms
memory: 10768kb

input:

2 2
7 7
7 7

output:

0 0 
-7 -7 

result:

ok correct

Test #32:

score: 6
Accepted
time: 1ms
memory: 10756kb

input:

2 4
7 7 7 7
7 7 7 7

output:

0 0 0 7 
0 0 0 -7 

result:

ok correct

Test #33:

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

input:

20 40
80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80
80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80
80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 ...

output:

0 -72 -72 -72 -72 -72 -72 -72 -72 -72 -72 -72 -72 -72 -72 -72 -72 -72 -72 -72 -72 -72 -72 -72 -72 -72 -72 -72 -72 -72 -72 -72 -72 -72 -72 -72 -72 -72 -72 2744 
-152 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
-152 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok correct

Test #34:

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

input:

20 40
10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 ...

output:

0 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 343 
-19 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
-19 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
-19 0 0 0 0 0...

result:

ok correct

Test #35:

score: 6
Accepted
time: 124ms
memory: 266652kb

input:

1000 1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 ...

output:

0 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -100...

result:

ok correct

Test #36:

score: 6
Accepted
time: 28ms
memory: 137176kb

input:

496 499
12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 1...

output:

0 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -1976 -197...

result:

ok correct

Test #37:

score: 6
Accepted
time: 44ms
memory: 137920kb

input:

499 498
117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 117 ...

output:

0 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 58149 5814...

result:

ok correct

Test #38:

score: 6
Accepted
time: 7ms
memory: 138276kb

input:

499 499
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok correct

Test #39:

score: 6
Accepted
time: 3ms
memory: 59132kb

input:

177 1000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok correct

Test #40:

score: 6
Accepted
time: 80ms
memory: 262964kb

input:

997 1000
871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871 871...

output:

0 -288301 -288301 -288301 -288301 -288301 -288301 -288301 -288301 -288301 -288301 -288301 -288301 -288301 -288301 -288301 -288301 -288301 -288301 -288301 -288301 -288301 -288301 -288301 -288301 -288301 -288301 -288301 -288301 -288301 -288301 -288301 -288301 -288301 -288301 -288301 -288301 -288301 -2...

result:

ok correct

Test #41:

score: 6
Accepted
time: 3ms
memory: 13408kb

input:

8 3
7 7 7
7 7 7
7 7 7
7 7 7
7 7 7
7 7 7
7 7 7
7 7 7

output:

0 0 7 
-7 0 0 
7 0 0 
7 0 0 
7 0 0 
-7 0 0 
-7 0 0 
0 0 -7 

result:

ok correct

Test #42:

score: 0
Wrong Answer
time: 0ms
memory: 12960kb

input:

3 8
7 7 7 7 7 7 7 7
7 7 7 7 7 7 7 7
7 7 7 7 7 7 7 7

output:

0 0 7 0 0 0 0 0 
-7 0 0 0 0 0 0 0 
7 0 0 0 0 0 0 0 

result:

wrong answer Rowsum 1 and columnsum 3 did not correspond to C

Subtask #5:

score: 0
Wrong Answer

Test #46:

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

input:

2 4
253 431 207 483
243 65 289 13

output:

0 8 232 199 
186 0 0 -243 

result:

ok correct

Test #47:

score: 0
Wrong Answer
time: 1ms
memory: 10460kb

input:

2 4
188 566 555 176
471 283 272 459

output:

0 -425 0 0 
329 0 0 0 

result:

wrong answer Rowsum 1 and columnsum 1 did not correspond to C

Subtask #6:

score: 0
Wrong Answer

Test #58:

score: 5
Accepted
time: 59ms
memory: 140888kb

input:

1000 1000
1 0 0 1 0 1 0 1 0 0 1 1 0 0 1 1 1 1 1 1 1 1 0 0 0 1 0 1 1 0 1 1 0 1 1 1 0 0 1 1 0 0 0 1 1 0 1 1 0 1 1 1 0 0 0 1 0 0 0 1 0 1 1 0 0 0 1 0 0 0 1 1 0 1 1 0 0 0 0 1 0 1 1 0 0 0 0 0 1 0 1 1 0 0 1 1 0 1 0 1 1 1 1 0 1 1 0 0 1 0 1 0 1 1 0 1 0 0 0 0 0 1 1 1 0 1 0 1 0 0 1 1 1 0 1 1 0 0 0 0 1 1 0 1 1 ...

output:

0 0 0 -1 0 -1 0 -1 0 0 -1 -1 0 0 -1 -1 -1 -1 -1 -1 -1 -1 0 0 0 -1 0 -1 -1 0 -1 -1 0 -1 -1 -1 0 0 -1 -1 0 0 0 -1 -1 0 -1 -1 0 -1 -1 -1 0 0 0 -1 0 0 0 -1 0 -1 -1 0 0 0 -1 0 0 0 -1 -1 0 -1 -1 0 0 0 0 -1 0 -1 -1 0 0 0 0 0 -1 0 -1 -1 0 0 -1 -1 0 -1 0 -1 -1 -1 -1 0 -1 -1 0 0 -1 0 -1 0 -1 -1 0 -1 0 0 0 0 0...

result:

ok correct

Test #59:

score: 5
Accepted
time: 96ms
memory: 263760kb

input:

1000 1000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -...

result:

ok correct

Test #60:

score: 5
Accepted
time: 8ms
memory: 14612kb

input:

177 1000
1 0 0 0 1 1 0 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 0 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 1 1 1 0 1 1 1 1 0 1 1 1 1 1 0 1 0 1 1 1 0 1 1 0 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 0 1...

output:

0 1 1 1 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 1 0 0 0 0 0 ...

result:

ok correct

Test #61:

score: 5
Accepted
time: 22ms
memory: 43268kb

input:

477 1000
1 0 0 0 0 1 0 1 0 0 1 1 0 0 1 0 0 1 0 1 1 0 1 0 0 0 1 0 1 1 0 1 1 1 1 0 1 0 1 0 0 1 0 0 1 1 0 0 0 1 1 0 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 0 1 1 0 1 1 1 1 1 0 0 0 1 0 0 0 0 1 1 0 1 1 1 0 0 0 1 1 0 1 1 0 0 1 0 0 0 1 0 1 1 1 1 1 1 1 1 1 0 1 0 0 1 1 0 1 0 0 0 0 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1 0 1 1 0...

output:

0 1 1 1 1 0 1 0 1 1 0 0 1 1 0 1 1 0 1 0 0 1 0 1 1 1 0 1 0 0 1 0 0 0 0 1 0 1 0 1 1 0 1 1 0 0 1 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 0 0 1 1 1 0 1 1 1 1 0 0 1 0 0 0 1 1 1 0 0 1 0 0 1 1 0 1 1 1 0 1 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 1 0 1 1 1 1 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 1 1 1 1 0 ...

result:

ok correct

Test #62:

score: 5
Accepted
time: 64ms
memory: 139752kb

input:

1000 871
0 1 1 1 1 1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 1 1 1 0 0 0 1 1 0 1 1 0 0 0 0 0 1 1 1 1 0 1 1 0 0 1 0 0 0 0 0 1 1 0 1 0 0 0 1 1 1 0 0 1 1 0 0 0 1 0 1 0 1 1 1 1 0 1 1 0 0 0 1 0 1 0 1 1 1 1 1 0 1 1 0 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 1 1 0 1 1 0 0 1 1 0 0 1 0 1 0 1 0 1 1 0 0 1 1 1 1 1 0 1 1 1 1 0 0 0 0...

output:

0 -1 -1 -1 -1 -1 0 0 0 -1 0 -1 0 0 -1 0 0 -1 0 -1 -1 -1 -1 0 0 0 -1 -1 0 -1 -1 0 0 0 0 0 -1 -1 -1 -1 0 -1 -1 0 0 -1 0 0 0 0 0 -1 -1 0 -1 0 0 0 -1 -1 -1 0 0 -1 -1 0 0 0 -1 0 -1 0 -1 -1 -1 -1 0 -1 -1 0 0 0 -1 0 -1 0 -1 -1 -1 -1 -1 0 -1 -1 0 -1 -1 -1 0 0 -1 -1 -1 -1 0 0 -1 -1 -1 -1 0 -1 -1 0 -1 -1 0 0 ...

result:

ok correct

Test #63:

score: 0
Wrong Answer
time: 71ms
memory: 263756kb

input:

1000 1000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -...

result:

wrong answer Rowsum 1 and columnsum 60 did not correspond to C

Subtask #7:

score: 0
Wrong Answer

Test #68:

score: 15
Accepted
time: 2ms
memory: 10572kb

input:

2 2
5 52
52 5

output:

0 0 
-5 -52 

result:

ok correct

Test #69:

score: 15
Accepted
time: 32ms
memory: 24856kb

input:

1000 1000
640 423 797 825 85 491 146 594 713 894 923 193 511 700 556 269 32 177 29 16 394 971 754 194 930 404 686 794 19 267 410 880 859 52 477 347 94 826 638 132 385 628 642 795 332 98 606 377 681 330 731 339 157 855 875 836 450 46 225 661 138 909 917 873 371 223 152 19 44 67 792 3 466 740 151 681 ...

output:

0 -558 -184 -156 -896 -490 -835 -387 -268 -87 -58 -788 -470 -281 -425 -712 -949 -804 -952 -965 -587 -10 -227 -787 -51 -577 -295 -187 -1000 -714 -571 -101 -122 -929 -504 -634 -887 -155 -343 -849 -596 -353 -339 -186 -649 -883 -375 -604 -300 -651 -250 -642 -824 -126 -106 -145 -531 -935 -756 -320 -843 -...

result:

ok correct

Test #70:

score: 15
Accepted
time: 39ms
memory: 21748kb

input:

1000 1000
26 347 442 93 41 633 378 574 17 254 45 40 505 163 309 257 90 394 74 555 350 496 602 5 228 40 317 266 78 175 172 417 290 129 633 6 601 530 24 500 522 201 391 82 557 123 248 614 204 249 165 58 567 458 340 142 180 544 61 39 498 633 551 273 167 225 469 88 131 4 221 218 470 520 59 209 276 365 1...

output:

0 -20 -809 -460 -408 -1000 -745 -941 -384 -113 -322 -407 -872 -204 -676 -624 -457 -761 -441 -922 -17 -863 -969 -362 -139 -407 -50 -101 -445 -192 -539 -784 -657 -496 -1000 -361 -968 -897 -391 -867 -889 -568 -758 -449 -924 -490 -119 -981 -571 -616 -532 -309 -934 -825 -27 -225 -187 -911 -306 -406 -865 ...

result:

ok correct

Test #71:

score: 15
Accepted
time: 111ms
memory: 264740kb

input:

1000 1000
177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 177 17...

output:

0 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -177 -17...

result:

ok correct

Test #72:

score: 0
Wrong Answer
time: 128ms
memory: 263296kb

input:

1000 1000
487 913 486 475 461 478 487 472 890 856 897 885 484 453 923 892 470 454 491 480 485 476 475 496 881 462 943 455 912 868 486 482 900 494 911 918 451 470 942 459 459 468 451 472 453 937 457 886 876 450 470 492 475 487 462 949 909 469 456 456 456 460 424 462 925 487 476 451 920 926 934 497 44...

output:

0 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -1000 -100...

result:

wrong answer Rowsum 1 and columnsum 2 did not correspond to C

Subtask #8:

score: 0
Skipped

Dependency #2:

0%

Subtask #9:

score: 0
Skipped

Dependency #1:

0%