QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#486333#8892. Power GridBaraa10#0 1361ms27080kbC++231.1kb2024-07-21 19:00:462024-07-21 19:00:46

Judging History

This is the latest submission verdict.

  • [2024-07-21 19:00:46]
  • Judged
  • Verdict: 0
  • Time: 1361ms
  • Memory: 27080kb
  • [2024-07-21 19:00:46]
  • Submitted

answer

#include <bits/stdc++.h>
#define ll long long
#define nl "\n"
#define all(v) v.begin(),v.end()
#define baraa ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
const ll limit=2147483648;
int main() {
    baraa
    ll n,m;
    cin>>n>>m;
    ll val[n][m];
    for(ll i=0;i<n;i++)
        for(ll j=0;j<m;j++)cin>>val[i][j];
    for(ll c=1;c<=1000;c++){
        ll v[n][m],tmp[n][m];
        v[0][0]=c;
        for(ll j=1;j<m;j++)v[0][j]=v[0][j-1]+(val[0][j-1]-val[0][j]);
        ll row[n],col[m];
        memset(row,0, sizeof(row));
        memset(col,0, sizeof(col));
        for(ll i=0;i<n;i++)
            for(ll j=0;j<m;j++)row[i]+=v[i][j],col[j]+=v[i][j];
        bool ok=1;
        for(ll i=0;i<n;i++)
            for(ll j=0;j<m;j++)tmp[i][j]=abs(row[i]-col[j]),ok&=(tmp[i][j]==val[i][j]&&v[i][j]<=limit&&v[i][j]>=-limit);
        if(ok){
            for(ll i=0;i<n;i++) {
                for (ll j = 0; j < m; j++)
                    cout << v[i][j] << ' ';
                cout<<nl;
            }
            break;
        }
    }
    return 0;
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

input:

1 1
0

output:

1 

result:

ok correct

Test #2:

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

input:

1 1
0

output:

1 

result:

ok correct

Test #3:

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

input:

1 2
1 1

output:

1 1 

result:

ok correct

Test #4:

score: -8
Wrong Answer
time: 0ms
memory: 3572kb

input:

3 1
0
3
1

output:


result:

wrong output format Unexpected end of file - int32 expected

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Wrong Answer

Test #23:

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

input:

1 1
0

output:

1 

result:

ok correct

Test #24:

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

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: 0
Accepted
time: 1ms
memory: 3596kb

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
Wrong Answer
time: 2ms
memory: 3584kb

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:


result:

wrong output format Unexpected end of file - int32 expected

Subtask #4:

score: 0
Wrong Answer

Test #30:

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

input:

2 2
0 0
0 0

output:


result:

wrong output format Unexpected end of file - int32 expected

Subtask #5:

score: 0
Wrong Answer

Test #46:

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

input:

2 4
253 431 207 483
243 65 289 13

output:


result:

wrong output format Unexpected end of file - int32 expected

Subtask #6:

score: 0
Wrong Answer

Test #58:

score: 0
Wrong Answer
time: 1361ms
memory: 27080kb

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:

wrong output format Unexpected end of file - int32 expected

Subtask #7:

score: 0
Wrong Answer

Test #68:

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

input:

2 2
5 52
52 5

output:


result:

wrong output format Unexpected end of file - int32 expected

Subtask #8:

score: 0
Skipped

Dependency #2:

0%

Subtask #9:

score: 0
Skipped

Dependency #1:

0%