QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#809197#8892. Power GridMax_s_xaM23 42ms20644kbC++175.8kb2024-12-11 13:11:332024-12-11 13:11:35

Judging History

This is the latest submission verdict.

  • [2024-12-11 13:11:35]
  • Judged
  • Verdict: 23
  • Time: 42ms
  • Memory: 20644kb
  • [2024-12-11 13:11:33]
  • 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;

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)
    {
        for (int i = 1; i <= m; i++)
            for (int j = 1; j <= n; j++)
                cout << ans[j][i] << ' ';
    }
    else
    {
        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];
}
inline bool Solve(int p, int q)
{
    int t;
    // for (int i = 1; i <= n; i++, cout << '\n')
    //     for (int j = 1; j <= m; j++)
    //         cout << c[i][j] << ' ';
    // cout << p << ' ' << q << "\n";
    t = (q == 1 ? 2 : q - 1);
    for (int i = 1; i <= m; i++) b[i] = -c[p][i];
    a[p] = 0;
    for (int i = 1; i <= n; i++)
        if (i != p)
        {
            if (c[i][q] + c[i][t] == b[t] - b[q]) a[i] = b[q] + c[i][q];
            else if (c[i][q] > c[i][t]) a[i] = b[t] + c[i][t];
            else a[i] = b[q] - c[i][q]; 
        }
    bool flag = 1;
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++) flag &= abs(a[i] - b[j]) == c[i][j];
    ll sum0 = 0, sum1 = 0;
    for (int i = 1; i <= n; i++) sum0 += a[i];
    for (int i = 1; i <= m; i++) sum1 += b[i];
    if (n == m && sum0 != sum1) flag = 0;
    else if (n != m && abs(sum0 - sum1) % abs(n - m) != 0) flag = 0;
    else if (n != m)
    {
        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;
    }
    if (flag) return Trans(), 1;
    t = (p == 1 ? 2 : p - 1);
    for (int i = 1; i <= n; i++) a[i] = c[i][q];
    b[q] = 0;
    for (int i = 1; i <= m; i++)
        if (i != q)
        {
            if (c[p][i] + c[t][i] == a[p] - a[t]) b[i] = a[p] - c[p][i];
            else if (c[p][i] > c[t][i]) b[i] = a[t] - c[t][i];
            else b[i] = a[p] + c[p][i];
        }
    flag = 1;
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++) flag &= abs(a[i] - b[j]) == c[i][j];
    sum0 = 0, sum1 = 0;
    for (int i = 1; i <= n; i++) sum0 += a[i];
    for (int i = 1; i <= m; i++) sum1 += b[i];
    if (n == m && sum0 != sum1) flag = 0;
    else if (n != m && abs(sum0 - sum1) % abs(n - m) != 0) flag = 0;
    else if (n != m)
    {
        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;
    }
    if (flag) return Trans(), 1;
    return 0;
}

int main()
{
    #if DEBUG
    #else
    ios::sync_with_stdio(0), cin.tie(0);
    #endif
    Read(n), Read(m);
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++)
            Read(c[i][j]);
    if (n == 1 || m == 1)
    {
        if (n == 1 && m == 1) return cout << "0\n", 0;
        if (m == 1) Swap();
        ll sum = 0;
        for (int i = 1; i <= m; i++) sum += c[1][i];
        sum /= m - 1;
        for (int i = 1; i <= m; i++) ans[1][i] = sum - c[1][i];
        Print();
        return 0;
    }
    int p = -1, q = -1, mx = 0;
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; 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: 8
Accepted

Test #1:

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

input:

1 1
0

output:

0

result:

ok correct

Test #2:

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

input:

1 1
0

output:

0

result:

ok correct

Test #3:

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

input:

1 2
1 1

output:

1 1 

result:

ok correct

Test #4:

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

input:

3 1
0
3
1

output:

2 -1 1 

result:

ok correct

Test #5:

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

input:

2 2
1 1
1 1

output:

0 0 
-1 -1 

result:

ok correct

Test #6:

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

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

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

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: 8
Accepted
time: 1ms
memory: 7772kb

input:

3 3
3 1 2
3 1 2
3 1 2

output:

0 4 -1 
3 0 0 
-3 0 6 

result:

ok correct

Test #10:

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

input:

3 3
3 3 3
0 0 0
3 3 3

output:

0 -3 3 
-3 0 0 
0 0 -6 

result:

ok correct

Subtask #2:

score: 0
Wrong Answer

Dependency #1:

100%
Accepted

Test #11:

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

input:

1 6
1 0 3 1 3 0

output:

0 1 -2 0 -2 1 

result:

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

Subtask #3:

score: 0
Wrong Answer

Test #23:

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

input:

1 1
0

output:

0

result:

ok correct

Test #24:

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

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

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

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
Wrong Answer
time: 1ms
memory: 7700kb

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:

170 -339 184 141 -296 144 155 -405 187 182 128 -364 123 131 148 127 160 -341 156 -349 -375 144 -367 141 171 130 156 177 151 -314 186 -354 141 -323 146 177 181 166 149 148 -300 -329 163 -374 -314 139 -335 162 -356 161 -380 159 211 133 164 161 129 178 -381 138 158 -374 160 -403 161 164 162 -387 -382 1...

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

input:

2 2
0 0
0 0

output:

0 0 
0 0 

result:

ok correct

Test #31:

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

input:

2 2
7 7
7 7

output:

0 0 
-7 -7 

result:

ok correct

Test #32:

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

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

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

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: 0
Wrong Answer
time: 41ms
memory: 13920kb

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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

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

Subtask #5:

score: 15
Accepted

Test #46:

score: 15
Accepted
time: 1ms
memory: 7700kb

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: 15
Accepted
time: 0ms
memory: 7860kb

input:

2 4
188 566 555 176
471 283 272 459

output:

0 -329 -318 884 
425 0 0 -471 

result:

ok correct

Test #48:

score: 15
Accepted
time: 1ms
memory: 7736kb

input:

5 6
39 93 668 330 117 610
13 145 720 382 65 662
417 285 290 48 495 232
210 78 497 159 288 439
813 681 106 444 891 164

output:

0 -181 394 56 -391 -152 
-326 0 0 0 0 0 
104 0 0 0 0 0 
-103 0 0 0 0 0 
12 0 0 0 0 488 

result:

ok correct

Test #49:

score: 15
Accepted
time: 1ms
memory: 7720kb

input:

4 7
330 140 57 520 147 685 359
70 540 457 120 547 285 41
168 638 555 22 645 187 139
425 45 38 615 52 780 454

output:

0 389 306 -271 396 -436 -135 
-151 0 0 0 0 0 0 
-249 0 0 0 0 0 0 
319 0 0 0 0 0 25 

result:

ok correct

Test #50:

score: 15
Accepted
time: 1ms
memory: 7876kb

input:

10 10
853 399 803 868 626 195 356 314 232 136
409 45 359 424 182 249 88 130 212 308
134 320 84 149 93 524 363 405 487 583
60 394 10 75 167 598 437 479 561 657
50 404 0 65 177 608 447 489 571 667
828 374 778 843 601 170 331 289 207 111
457 3 407 472 230 201 40 82 164 260
34 420 16 49 193 624 463 505 ...

output:

0 -399 -803 -868 -626 -195 -356 -314 -232 3793 
-444 0 0 0 0 0 0 0 0 0 
-719 0 0 0 0 0 0 0 0 0 
-793 0 0 0 0 0 0 0 0 0 
-803 0 0 0 0 0 0 0 0 0 
-25 0 0 0 0 0 0 0 0 0 
-396 0 0 0 0 0 0 0 0 0 
-819 0 0 0 0 0 0 0 0 0 
-323 0 0 0 0 0 0 0 0 0 
3469 0 0 0 0 0 0 0 0 -3929 

result:

ok correct

Test #51:

score: 15
Accepted
time: 1ms
memory: 7856kb

input:

10 10
376 557 253 418 586 309 363 261 20 193
343 524 220 385 553 276 330 228 53 160
322 141 445 280 112 389 335 437 718 505
123 58 246 81 87 190 136 238 519 306
39 142 162 3 171 106 52 154 435 222
6 175 129 36 204 73 19 121 402 189
297 478 174 339 507 230 284 182 99 114
441 260 564 399 231 508 454 5...

output:

0 -260 -564 -399 -231 -508 -454 -556 -837 2992 
-784 0 0 0 0 0 0 0 0 0 
-119 0 0 0 0 0 0 0 0 0 
-318 0 0 0 0 0 0 0 0 0 
-402 0 0 0 0 0 0 0 0 0 
-435 0 0 0 0 0 0 0 0 0 
-738 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 
-471 0 0 0 0 0 0 0 0 0 
2826 0 0 0 0 0 0 0 0 -3616 

result:

ok correct

Test #52:

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

input:

10 10
608 306 681 555 168 504 161 276 342 308
236 66 309 183 204 132 211 96 30 64
589 287 662 536 149 485 142 257 323 289
70 372 3 123 510 174 517 402 336 370
160 462 87 213 600 264 607 492 426 460
178 124 251 125 262 74 269 154 88 122
458 156 531 405 18 354 11 126 192 158
61 241 134 8 379 43 386 27...

output:

0 -306 -681 -555 -168 -504 -161 -276 -342 2993 
-372 0 0 0 0 0 0 0 0 0 
-19 0 0 0 0 0 0 0 0 0 
-678 0 0 0 0 0 0 0 0 0 
-768 0 0 0 0 0 0 0 0 0 
-430 0 0 0 0 0 0 0 0 0 
-150 0 0 0 0 0 0 0 0 0 
-547 0 0 0 0 0 0 0 0 0 
-719 0 0 0 0 0 0 0 0 0 
3075 0 0 0 0 0 0 0 0 -3301 

result:

ok correct

Test #53:

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

input:

2 4
1 2 3 4
5 6 7 8

output:

0 5 4 -2 
6 0 0 5 

result:

ok correct

Test #54:

score: 15
Accepted
time: 1ms
memory: 7816kb

input:

10 20
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
10...

output:

0 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 -1698 
131 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
151 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
171 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
191 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
211 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
231 0 0 0 0 ...

result:

ok correct

Test #55:

score: 15
Accepted
time: 1ms
memory: 7788kb

input:

21 42
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 10...

output:

0 461 460 459 458 457 456 455 454 453 452 451 450 449 448 447 446 445 444 443 442 441 440 439 438 437 436 435 434 433 432 431 430 429 428 427 426 425 424 423 422 -17197 
505 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
547 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok correct

Test #56:

score: 15
Accepted
time: 1ms
memory: 7888kb

input:

8 11
350 680 125 424 555 68 443 319 540 709 71
170 160 395 96 35 452 77 201 20 189 449
121 451 104 195 326 161 214 90 311 480 158
322 8 547 248 117 604 229 353 132 37 601
156 174 381 82 49 438 63 187 34 203 435
251 581 26 325 456 31 344 220 441 610 28
513 183 738 439 308 795 420 544 323 154 792
116 ...

output:

0 293 -262 37 168 -319 56 -68 153 322 -767 
133 0 0 0 0 0 0 0 0 0 0 
-158 0 0 0 0 0 0 0 0 0 0 
285 0 0 0 0 0 0 0 0 0 0 
119 0 0 0 0 0 0 0 0 0 0 
-288 0 0 0 0 0 0 0 0 0 0 
476 0 0 0 0 0 0 0 0 0 0 
-604 0 0 0 0 0 0 0 0 0 451 

result:

ok correct

Test #57:

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

input:

15 5
148 610 23 697 750
176 286 301 373 426
528 66 653 21 74
64 526 61 613 666
133 595 8 682 735
122 584 3 671 724
637 175 762 88 35
196 266 321 353 406
607 145 732 58 5
87 375 212 462 515
234 696 109 783 836
484 22 609 65 118
495 33 620 54 107
598 136 723 49 4
421 41 546 128 181

output:

0 -258 329 -345 626 
28 0 0 0 0 
-324 0 0 0 0 
268 0 0 0 0 
337 0 0 0 0 
326 0 0 0 0 
-433 0 0 0 0 
8 0 0 0 0 
-403 0 0 0 0 
117 0 0 0 0 
438 0 0 0 0 
-280 0 0 0 0 
-291 0 0 0 0 
-394 0 0 0 0 
807 0 0 0 -1024 

result:

ok correct

Subtask #6:

score: 0
Wrong Answer

Test #58:

score: 5
Accepted
time: 36ms
memory: 20416kb

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: 0
Wrong Answer
time: 42ms
memory: 13864kb

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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

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

Subtask #7:

score: 0
Wrong Answer

Test #68:

score: 15
Accepted
time: 1ms
memory: 7824kb

input:

2 2
5 52
52 5

output:

0 0 
-5 -52 

result:

ok correct

Test #69:

score: 15
Accepted
time: 37ms
memory: 19844kb

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: 33ms
memory: 20644kb

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: 0
Wrong Answer
time: 41ms
memory: 12684kb

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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

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

Subtask #8:

score: 0
Skipped

Dependency #2:

0%

Subtask #9:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%