QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#469431#8892. Power GridLynkcat#19 85ms25872kbC++201.9kb2024-07-09 19:08:432024-07-09 19:08:44

Judging History

This is the latest submission verdict.

  • [2024-07-09 19:08:44]
  • Judged
  • Verdict: 19
  • Time: 85ms
  • Memory: 25872kb
  • [2024-07-09 19:08:43]
  • Submitted

answer

#include<bits/stdc++.h>
#define poly vector<int>
#define IOS ios::sync_with_stdio(false)
#define ll long long
#define mp make_pair
#define mt make_tuple
#define pa pair < int,int >
#define fi first
#define se second
#define inf 1e18
#define mod 998244353
#define sz(x) ((int)((x).size()))
#define int ll
// #define N 
using namespace std;
const int N=1005;
int n,m;
int ans[N][N],b[N],a[N];
int c[N][N];
map<int,int>f[N];
int dl;
void dfs(int k,int sm)
{
    if (f[k].count(sm)) return;

    if (k==n)
    {
        if (sm!=0&&(n==m||sm%(n-m)!=0)) return;

        int o=0;
        if (sm!=0) o=sm/(n-m);
        for (int i=0;i<m;i++) a[i]-=o;
        for (int i=0;i<n;i++) b[i]-=o;

        for (int i=1;i<m;i++) ans[0][i]=a[i],b[0]-=a[i];
        for (int i=0;i<n;i++)
        {
            ans[i][0]=b[i];
        }
        for (int i=0;i<n;i++)
        {
            for (int j=0;j<m;j++) cout<<ans[i][j]<<" ";
            cout<<'\n';
        }
        fflush(stdout);
        exit(0);
    }
    poly gg;
    gg.push_back(a[0]-c[k][0]);
    gg.push_back(a[0]+c[k][0]);
    for (auto i:gg)
    {
        b[k]=i;
        bool bl=1;
        for (int j=0;j<m;j++)
        {
            if (abs(b[k]-a[j])!=c[k][j])
            {
                bl=0;
                break;
            }
        }
        if (bl) dfs(k+1,sm+i);
    }
    f[k][sm]=1;
}
mt19937_64 rnd(time(0));
void BellaKira()
{
    cin>>n>>m;
    for (int i=0;i<n;i++)
        for (int j=0;j<m;j++)
            cin>>c[i][j],dl=max(dl,c[i][j]);
    while (1)
    {
        for (int i=0;i<m;i++)
        {
            a[i]=c[0][i];
            if (rnd()%2) a[i]=-a[i];
        }
        int sm=0;
        for (int i=0;i<m;i++) sm-=a[i];
        dfs(1,sm);
        for (int i=1;i<n;i++) f[i].clear();
    }
}
signed main()
{
	IOS;
	cin.tie(0);
	int T=1;
	while (T--)
	{
		BellaKira();
	}
}

详细

Subtask #1:

score: 8
Accepted

Test #1:

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

input:

1 1
0

output:

0 

result:

ok correct

Test #2:

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

input:

1 1
0

output:

0 

result:

ok correct

Test #3:

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

input:

1 2
1 1

output:

1 -1 

result:

ok correct

Test #4:

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

input:

3 1
0
3
1

output:

2 
-1 
1 

result:

ok correct

Test #5:

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

input:

2 2
1 1
1 1

output:

1 -1 
0 0 

result:

ok correct

Test #6:

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

input:

3 3
2 1 1
2 1 1
0 1 3

output:

0 -1 1 
0 0 0 
-2 0 0 

result:

ok correct

Test #7:

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

input:

3 3
0 1 0
2 1 2
1 2 1

output:

1 -1 0 
-2 0 0 
1 0 0 

result:

ok correct

Test #8:

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

input:

3 3
0 0 2
2 2 0
0 0 2

output:

-2 0 2 
2 0 0 
0 0 0 

result:

ok correct

Test #9:

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

input:

3 3
3 1 2
3 1 2
3 1 2

output:

-3 1 2 
0 0 0 
0 0 0 

result:

ok correct

Test #10:

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

input:

3 3
3 3 3
0 0 0
3 3 3

output:

-6 3 3 
3 0 0 
6 0 0 

result:

ok correct

Subtask #2:

score: 5
Accepted

Dependency #1:

100%
Accepted

Test #11:

score: 5
Accepted
time: 1ms
memory: 5784kb

input:

1 6
1 0 3 1 3 0

output:

-1 0 3 1 -3 0 

result:

ok correct

Test #12:

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

input:

6 1
2
1
1
1
5
0

output:

0 
1 
1 
1 
-3 
2 

result:

ok correct

Test #13:

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

input:

6 6
3 1 0 3 4 0
1 1 2 1 2 2
1 1 2 1 2 2
1 3 4 1 0 4
1 1 2 1 2 2
2 0 1 2 3 1

output:

8 -1 0 -3 -4 0 
-2 0 0 0 0 0 
-2 0 0 0 0 0 
-4 0 0 0 0 0 
-2 0 0 0 0 0 
-1 0 0 0 0 0 

result:

ok correct

Test #14:

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

input:

6 6
2 4 4 0 2 2
5 1 1 3 1 1
4 2 2 2 0 0
2 4 4 0 2 2
6 0 0 4 2 2
3 3 3 1 1 1

output:

-12 4 4 0 2 2 
3 0 0 0 0 0 
2 0 0 0 0 0 
0 0 0 0 0 0 
4 0 0 0 0 0 
1 0 0 0 0 0 

result:

ok correct

Test #15:

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

input:

6 6
1 0 4 5 3 2
4 5 1 0 2 3
3 4 0 1 1 2
2 3 1 2 0 1
1 2 2 3 1 0
0 1 3 4 2 1

output:

-14 0 4 5 3 2 
5 0 0 0 0 0 
4 0 0 0 0 0 
3 0 0 0 0 0 
2 0 0 0 0 0 
1 0 0 0 0 0 

result:

ok correct

Test #16:

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

input:

6 6
6 4 2 4 1 3
6 4 2 4 1 3
6 4 2 4 1 3
6 4 2 4 1 3
6 4 2 4 1 3
6 4 2 4 1 3

output:

-6 4 2 4 -1 -3 
0 0 0 0 0 0 
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 #17:

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

input:

6 3
6 3 3
6 3 3
6 3 3
6 3 3
6 3 3
6 3 3

output:

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

result:

ok correct

Test #18:

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

input:

6 3
1 1 1
2 2 2
5 5 5
6 6 6
6 6 6
2 2 2

output:

-7 6 6 
4 0 0 
1 0 0 
0 0 0 
0 0 0 
8 0 0 

result:

ok correct

Test #19:

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

input:

3 6
6 5 5 5 5 5
6 5 5 5 5 5
6 5 5 5 5 5

output:

13 -12 -2 -2 -2 -2 
-7 0 0 0 0 0 
-7 0 0 0 0 0 

result:

ok correct

Test #20:

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

input:

6 3
5 5 5
5 5 5
6 6 6
5 5 5
5 5 5
5 5 5

output:

-12 7 7 
2 0 0 
1 0 0 
2 0 0 
2 0 0 
12 0 0 

result:

ok correct

Test #21:

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

input:

6 4
1 6 2 3
1 6 2 3
1 6 2 3
1 6 2 3
1 6 2 3
1 6 2 3

output:

1 -6 2 3 
0 0 0 0 
0 0 0 0 
0 0 0 0 
0 0 0 0 
0 0 0 0 

result:

ok correct

Test #22:

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

input:

6 6
2 2 1 4 1 1
2 2 1 4 1 1
3 3 0 3 0 2
2 2 1 4 1 1
2 2 1 4 1 1
2 2 1 4 1 1

output:

3 2 -1 -4 -1 1 
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 

result:

ok correct

Subtask #3:

score: 0
Time Limit Exceeded

Test #23:

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

input:

1 1
0

output:

0 

result:

ok correct

Test #24:

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

input:

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

output:

-152 -211 996 -674 302 262 651 -139 -320 -637 

result:

ok correct

Test #25:

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

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:

-282 -424 529 342 241 -20 -881 -76 363 -330 -903 -354 -12 -941 609 -316 -720 -944 362 -953 -313 -877 396 539 120 361 -844 467 -274 974 -148 402 524 -770 -589 -762 469 516 392 -654 102 299 -828 -392 -266 -525 -463 843 7 -542 -457 267 200 710 -904 921 -984 531 862 -490 757 419 568 -853 -21 -651 -361 -...

result:

ok correct

Test #26:

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

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:

692 581 -524 558 -91 304 292 679 -551 405 -207 -969 -391 -452 -702 160 119 -958 533 -176 621 990 -266 -797 -533 -230 -250 365 892 977 -335 708 -47 -602 -343 478 -204 850 916 919 760 -585 -249 404 -335 945 261 403 460 726 -505 762 998 157 861 -887 791 -321 28 -720 -111 -594 23 210 -467 -41 -570 -419 ...

result:

ok correct

Test #27:

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

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:

375 -892 361 -412 841 401 390 950 -366 363 -425 -917 -430 414 -405 418 385 -894 -397 -902 920 401 912 404 374 -423 389 368 394 859 359 899 404 -876 -407 -376 364 379 396 -405 -853 -882 382 -927 -867 406 -888 383 -909 384 -933 386 334 -420 -389 -392 -424 367 926 -415 -395 -927 385 948 -392 -389 -391 ...

result:

ok correct

Test #28:

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

input:

1 1000
1 0 0 3 1 0 0 0 0 0 0 2 1 1 0 0 1 0 1 0 0 0 2 3 0 0 2 0 3 2 2 1 1 0 2 0 1 2 1 0 0 1 0 1 0 0 1 1 2 2 1 0 0 0 1 3 2 3 1 1 0 1 2 1 1 0 2 1 1 2 1 2 1 4 1 2 0 2 2 1 0 1 2 4 1 0 1 1 2 0 4 1 1 0 0 0 0 1 1 0 0 1 0 0 2 1 1 2 1 0 4 1 2 2 0 1 0 0 0 1 2 3 0 0 1 2 0 2 2 0 1 2 0 2 1 1 2 0 2 0 0 0 0 1 0 1 1...

output:

0 1 1 4 0 1 1 1 1 1 1 3 0 2 1 1 2 1 0 1 1 1 -1 -2 1 1 -1 1 -2 -1 -1 0 2 1 3 1 0 3 2 1 1 2 1 0 1 1 2 0 3 3 0 1 1 1 2 4 -1 -2 2 2 1 0 3 2 2 1 3 0 0 -1 0 -1 0 5 2 -1 1 3 3 2 1 0 -1 -3 0 1 2 2 3 1 5 0 0 1 1 1 1 0 0 1 1 0 1 1 -1 0 2 3 2 1 5 2 -1 -1 1 2 1 1 1 2 3 -2 1 1 2 3 1 3 3 1 2 -1 1 -1 2 2 -1 1 -1 1...

result:

ok correct

Test #29:

score: -11
Time Limit Exceeded

input:

1 766
1 0 1 0 1 2 0 3 0 0 1 2 0 1 0 2 0 1 1 4 1 3 0 0 2 2 2 2 1 1 1 2 1 2 0 1 2 1 2 0 4 0 1 0 0 0 0 0 1 2 0 0 1 2 2 4 1 1 1 2 0 1 3 2 1 0 0 0 0 1 0 1 0 1 2 2 3 0 3 1 0 0 1 1 0 1 4 3 1 2 0 3 0 1 1 2 1 2 1 1 2 0 1 0 0 2 1 1 2 0 2 0 0 1 1 3 1 0 1 2 1 0 0 3 2 0 0 2 2 0 0 1 0 1 1 1 2 0 2 3 1 1 1 3 0 0 2 ...

output:


result:


Subtask #4:

score: 6
Accepted

Test #30:

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

input:

2 2
0 0
0 0

output:

0 0 
0 0 

result:

ok correct

Test #31:

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

input:

2 2
7 7
7 7

output:

-7 7 
0 0 

result:

ok correct

Test #32:

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

input:

2 4
7 7 7 7
7 7 7 7

output:

-7 0 0 0 
-7 0 0 0 

result:

ok correct

Test #33:

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

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:

64 72 72 72 -88 -88 72 -88 72 72 -88 72 72 72 -88 72 72 -88 -88 -88 -88 72 72 72 72 -88 72 -88 -88 -88 72 -88 -88 72 72 -88 -88 -88 72 72 
-8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
-8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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: 0
Accepted
time: 0ms
memory: 6136kb

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:

8 9 9 9 -11 -11 9 -11 9 9 -11 9 9 9 -11 9 9 -11 -11 -11 -11 9 9 9 9 -11 9 -11 -11 -11 9 -11 -11 9 9 -11 -11 -11 9 9 
-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 
-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 
-1 0 0 0 0 0 0 0 0 ...

result:

ok correct

Test #35:

score: 0
Accepted
time: 85ms
memory: 19452kb

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:

-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 -100...

result:

ok correct

Test #36:

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

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:

-17796 48 48 48 24 24 48 24 48 48 24 48 48 48 24 48 48 24 24 24 24 48 48 48 48 24 48 24 24 24 48 24 24 48 48 24 24 24 48 48 48 48 24 48 24 24 48 48 24 48 48 48 48 48 24 48 24 48 48 24 24 48 48 48 24 48 24 48 24 48 48 24 24 24 48 48 24 24 24 48 24 48 48 24 48 48 24 24 24 48 24 24 48 24 48 48 48 24 48...

result:

ok correct

Test #37:

score: 0
Accepted
time: 20ms
memory: 14196kb

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:

581373 -1053 -1053 -1053 -1287 -1287 -1053 -1287 -1053 -1053 -1287 -1053 -1053 -1053 -1287 -1053 -1053 -1287 -1287 -1287 -1287 -1053 -1053 -1053 -1053 -1287 -1053 -1287 -1287 -1287 -1053 -1287 -1287 -1053 -1053 -1287 -1287 -1287 -1053 -1053 -1053 -1053 -1287 -1053 -1287 -1287 -1053 -1053 -1287 -1053...

result:

ok correct

Test #38:

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

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: 0
Accepted
time: 8ms
memory: 7240kb

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: 0
Accepted
time: 69ms
memory: 18880kb

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:

3467451 -4355 -2613 -2613 -4355 -2613 -4355 -4355 -2613 -4355 -2613 -4355 -4355 -2613 -4355 -4355 -2613 -4355 -2613 -2613 -4355 -2613 -2613 -4355 -4355 -4355 -2613 -2613 -2613 -2613 -4355 -2613 -4355 -2613 -2613 -4355 -4355 -4355 -2613 -4355 -2613 -4355 -2613 -2613 -4355 -4355 -4355 -4355 -4355 -261...

result:

ok correct

Test #41:

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

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:

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

result:

ok correct

Test #42:

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

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:

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

result:

ok correct

Test #43:

score: 0
Accepted
time: 23ms
memory: 25872kb

input:

1000 3
937 937 937
937 937 937
937 937 937
937 937 937
937 937 937
937 937 937
937 937 937
937 937 937
937 937 937
937 937 937
937 937 937
937 937 937
937 937 937
937 937 937
937 937 937
937 937 937
937 937 937
937 937 937
937 937 937
937 937 937
937 937 937
937 937 937
937 937 937
937 937 937
937 9...

output:

937 0 0 
-937 0 0 
-937 0 0 
-937 0 0 
-937 0 0 
-937 0 0 
-937 0 0 
-937 0 0 
-937 0 0 
-937 0 0 
-937 0 0 
-937 0 0 
-937 0 0 
-937 0 0 
-937 0 0 
-937 0 0 
-937 0 0 
-937 0 0 
-937 0 0 
-937 0 0 
-937 0 0 
-937 0 0 
-937 0 0 
-937 0 0 
-937 0 0 
-937 0 0 
-937 0 0 
-937 0 0 
-937 0 0 
-937 0 0 
-...

result:

ok correct

Test #44:

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

input:

7 1000
937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 937 9...

output:

-937 -937 -937 937 937 937 -937 -937 937 937 937 -937 -937 -937 937 -937 -937 -937 -937 -937 -937 -937 937 -937 -937 -937 937 937 937 -937 -937 -937 937 -937 -937 -937 -937 937 937 937 -937 -937 937 937 937 -937 -937 -937 937 -937 937 937 937 -937 937 -937 937 937 -937 -937 937 -937 -937 937 937 -93...

result:

ok correct

Test #45:

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

input:

87 97
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:

75500 100 100 100 -1900 -1900 100 -1900 100 100 -1900 100 100 100 -1900 100 100 -1900 -1900 -1900 -1900 100 100 100 100 -1900 100 -1900 -1900 -1900 100 -1900 -1900 100 100 -1900 -1900 -1900 100 100 100 100 -1900 100 -1900 -1900 100 100 -1900 100 100 100 100 100 -1900 100 -1900 100 100 -1900 -1900 10...

result:

ok correct

Subtask #5:

score: 0
Time Limit Exceeded

Test #46:

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

input:

2 4
253 431 207 483
243 65 289 13

output:

-243 -8 -232 44 
57 0 0 0 

result:

ok correct

Test #47:

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

input:

2 4
188 566 555 176
471 283 272 459

output:

-471 329 318 -413 
46 0 0 0 

result:

ok correct

Test #48:

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

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:

-488 -181 394 56 -391 336 
-326 0 0 0 0 0 
104 0 0 0 0 0 
-103 0 0 0 0 0 
500 0 0 0 0 0 

result:

ok correct

Test #49:

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

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:

-25 389 306 -271 396 -436 -110 
-151 0 0 0 0 0 0 
-249 0 0 0 0 0 0 
344 0 0 0 0 0 0 

result:

ok correct

Test #50:

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

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:

-3929 399 803 868 626 195 356 314 232 136 
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 
460 0 0 0 0 0 0 0 0 0 

result:

ok correct

Test #51:

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

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:

2920 -557 -253 -418 -586 -309 -363 -261 20 -193 
-33 0 0 0 0 0 0 0 0 0 
-698 0 0 0 0 0 0 0 0 0 
-499 0 0 0 0 0 0 0 0 0 
-415 0 0 0 0 0 0 0 0 0 
-382 0 0 0 0 0 0 0 0 0 
-79 0 0 0 0 0 0 0 0 0 
-817 0 0 0 0 0 0 0 0 0 
-346 0 0 0 0 0 0 0 0 0 
-27 0 0 0 0 0 0 0 0 0 

result:

ok correct

Test #52:

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

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:

-3301 306 681 555 168 504 161 276 342 308 
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 
226 0 0 0 0 0 0 0 0 0 

result:

ok correct

Test #53:

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

input:

2 4
1 2 3 4
5 6 7 8

output:

5 -5 -4 -3 
-11 0 0 0 

result:

ok correct

Test #54:

score: 0
Accepted
time: 34ms
memory: 5992kb

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:

-1789 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 
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
Time Limit Exceeded

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:


result:


Subtask #6:

score: 0
Time Limit Exceeded

Test #58:

score: 0
Time Limit Exceeded

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:


result:


Subtask #7:

score: 0
Time Limit Exceeded

Test #68:

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

input:

2 2
5 52
52 5

output:

52 -52 
-47 0 

result:

ok correct

Test #69:

score: -15
Time Limit Exceeded

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:


result:


Subtask #8:

score: 0
Time Limit Exceeded

Dependency #2:

100%
Accepted

Test #83:

score: 0
Time Limit Exceeded

input:

100 100
14 50 6 9 35 31 9 1 40 31 30 17 58 53 33 43 19 37 41 35 20 51 29 44 20 19 4 4 59 29 56 50 37 38 49 59 41 1 37 10 19 41 2 4 29 20 13 7 25 25 54 31 38 14 22 3 35 37 22 49 35 29 1 24 23 7 38 9 41 33 55 19 19 17 8 55 59 9 29 8 40 36 21 3 12 24 59 59 2 14 59 59 0 15 19 37 2 9 3 20
60 4 40 55 81 1...

output:


result:


Subtask #9:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

0%