QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#809394#8892. Power GridMax_s_xaM0 105ms268348kbC++175.0kb2024-12-11 14:47:162024-12-11 14:47:17

Judging History

This is the latest submission verdict.

  • [2024-12-11 14:47:17]
  • Judged
  • Verdict: 0
  • Time: 105ms
  • Memory: 268348kb
  • [2024-12-11 14:47:16]
  • 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()
{
    if (n == 1)
    {
        for (int i = 1; i <= m; i++) ans[1][i] = b[i];
        return;
    }
    if (m == 1)
    {
        for (int i = 1; i <= n; i++) ans[i][1] = a[i];
        return;
    }
    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;
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

input:

1 1
0

output:

0 

result:

ok correct

Test #2:

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

input:

1 1
0

output:

0 

result:

ok correct

Test #3:

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

input:

1 2
1 1

output:

1 1 

result:

ok correct

Test #4:

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

input:

3 1
0
3
1

output:

-1 
2 
-2 

result:

ok correct

Test #5:

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

input:

2 2
1 1
1 1

output:

0 0 
-1 -1 

result:

ok correct

Test #6:

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

input:

3 3
2 1 1
2 1 1
0 1 3

output:

0 -1 -1 
-2 0 0 
2 0 -2 

result:

ok correct

Test #7:

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

input:

3 3
0 1 0
2 1 2
1 2 1

output:

0 -1 -1 
0 0 0 
-2 0 -1 

result:

ok correct

Test #8:

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

input:

3 3
0 0 2
2 2 0
0 0 2

output:

0 0 0 
-2 0 0 
2 0 -2 

result:

ok correct

Test #9:

score: 0
Wrong Answer
time: 2ms
memory: 10972kb

input:

3 3
3 1 2
3 1 2
3 1 2

output:

0 -3 3 
-4 0 0 
1 0 -6 

result:

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

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Runtime Error

Test #23:

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

input:

1 1
0

output:

0 

result:

ok correct

Test #24:

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

input:

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

output:

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

result:

ok correct

Test #25:

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

input:

1 1000
298 440 513 326 225 36 897 92 347 346 919 370 28 957 593 332 736 960 346 969 329 893 380 523 104 345 860 451 290 958 164 386 508 786 605 778 453 500 376 670 86 283 844 408 282 541 479 827 9 558 473 251 184 694 920 905 1000 515 846 506 741 403 552 869 37 667 377 350 711 304 509 471 164 901 487...

output:

202 60 -13 174 275 464 -397 408 153 154 -419 130 472 -457 -93 168 -236 -460 154 -469 171 -393 120 -23 396 155 -360 49 210 -458 336 114 -8 -286 -105 -278 47 0 124 -170 414 217 -344 92 218 -41 21 -327 491 -58 27 249 316 -194 -420 -405 -500 -15 -346 -6 -241 97 -52 -369 463 -167 123 150 -211 196 -9 29 3...

result:

ok correct

Test #26:

score: 11
Accepted
time: 0ms
memory: 10508kb

input:

1 1000
684 573 532 550 99 296 284 671 559 397 215 977 399 460 710 152 111 966 525 184 613 982 274 805 541 238 258 357 884 969 343 700 55 610 351 470 212 842 908 911 752 593 257 396 343 937 253 395 452 718 513 754 990 149 853 895 783 329 20 728 119 602 15 202 475 49 578 427 27 349 547 225 223 209 197...

output:

-184 -73 -32 -50 401 204 216 -171 -59 103 285 -477 101 40 -210 348 389 -466 -25 316 -113 -482 226 -305 -41 262 242 143 -384 -469 157 -200 445 -110 149 30 288 -342 -408 -411 -252 -93 243 104 157 -437 247 105 48 -218 -13 -254 -490 351 -353 -395 -283 171 480 -228 381 -102 485 298 25 451 -78 73 473 151 ...

result:

ok correct

Test #27:

score: 0
Runtime Error

input:

1 1000
379 888 365 408 845 405 394 954 362 367 421 913 426 418 401 422 389 890 393 898 924 405 916 408 378 419 393 372 398 863 363 903 408 872 403 372 368 383 400 401 849 878 386 923 863 410 884 387 905 388 929 390 338 416 385 388 420 371 930 411 391 923 389 952 388 385 387 936 931 384 867 889 390 8...

output:


result:


Subtask #4:

score: 0
Wrong Answer

Test #30:

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

input:

2 2
0 0
0 0

output:

0 0 
0 0 

result:

ok correct

Test #31:

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

input:

2 2
7 7
7 7

output:

0 0 
-7 -7 

result:

ok correct

Test #32:

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

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: 16184kb

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: 3ms
memory: 16044kb

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: 94ms
memory: 268348kb

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: 31ms
memory: 136920kb

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: 39ms
memory: 136076kb

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: 31ms
memory: 138076kb

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: 11ms
memory: 54020kb

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: 91ms
memory: 261904kb

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: 13488kb

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: 12860kb

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: 1ms
memory: 10588kb

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: 10528kb

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: 39ms
memory: 141004kb

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: 105ms
memory: 262392kb

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: 4ms
memory: 14628kb

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: 26ms
memory: 42396kb

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: 53ms
memory: 138364kb

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: 84ms
memory: 263684kb

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: 0ms
memory: 10516kb

input:

2 2
5 52
52 5

output:

0 0 
-5 -52 

result:

ok correct

Test #69:

score: 15
Accepted
time: 40ms
memory: 23988kb

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: 32ms
memory: 21736kb

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: 92ms
memory: 263708kb

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: 91ms
memory: 264116kb

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%