QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#486339 | #8892. Power Grid | Baraa10# | 0 | 34ms | 27140kb | C++23 | 1.1kb | 2024-07-21 19:02:11 | 2024-07-21 19:02:12 |
Judging History
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<=1;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;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 8
Accepted
time: 0ms
memory: 3524kb
input:
1 1 0
output:
1
result:
ok correct
Test #2:
score: 0
Accepted
time: 0ms
memory: 3548kb
input:
1 1 0
output:
1
result:
ok correct
Test #3:
score: 0
Accepted
time: 0ms
memory: 3488kb
input:
1 2 1 1
output:
1 1
result:
ok correct
Test #4:
score: -8
Wrong Answer
time: 0ms
memory: 3496kb
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: 3544kb
input:
1 1 0
output:
1
result:
ok correct
Test #24:
score: -11
Wrong Answer
time: 0ms
memory: 3524kb
input:
1 10 230 289 918 752 224 184 573 217 398 715
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: 3528kb
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: 3640kb
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: 34ms
memory: 27140kb
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: 3528kb
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%