QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#469252#4786. BalancePlentyOfPenaltyWA 0ms4048kbC++17714b2024-07-09 16:44:432024-07-09 16:44:43

Judging History

你现在查看的是最新测评结果

  • [2024-07-09 16:44:43]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:4048kb
  • [2024-07-09 16:44:43]
  • 提交

answer

#include<bits/stdc++.h>
typedef long long ll;
void umax(ll& a,ll t)
{
    if(t>a)a=t;
}
const int MAXN = 1011;
ll a[MAXN][MAXN];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;++i)
        for(int j=1;j<=n;++j)
            scanf("%lld",&a[i][j]);
    for(int i=2;i<=n;++i)
    {
        ll delta=a[i][1]-a[i-1][1];
        for(int j=2;j<=n;++j)umax(delta,a[i][j]-a[i-1][j]);
        for(int j=1;j<=n;++j)a[i][j]=a[i-1][j]+delta;
    }
    ll sum=0;
    for(int i=1;i<=n;++i)
        for(int j=1;j<=n;++j)sum+=a[i][j];
    printf("%lld\n",sum);
    for(int i=1;i<=n;++i)
        for(int j=1;j<=n;++j)
            printf("%lld%c",a[i][j],j==n?'\n':' ');
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3884kb

input:

4
1 1 1 1
1 1 1 1
1 1 1 0
1 1 1 1

output:

16
1 1 1 1
1 1 1 1
1 1 1 1
1 1 1 1

result:

ok correct plan, good job!

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 4048kb

input:

24
20594 15420 1258 6283 18795 7007 20323 16605 27476 270 2082 5286 32911 30847 17237 14187 9258 26749 27575 8042 2690 25493 23540 30506
15252 21600 26878 32384 22641 12550 29190 28725 33837 7235 6316 1318 10773 4177 6535 33628 31431 19567 25294 22712 18861 16725 25214 12950
29777 22466 16743 2033 3...

output:

25039704
20594 15420 1258 6283 18795 7007 20323 16605 27476 270 2082 5286 32911 30847 17237 14187 9258 26749 27575 8042 2690 25493 23540 30506
46695 41521 27359 32384 44896 33108 46424 42706 53577 26371 28183 31387 59012 56948 43338 40288 35359 52850 53676 34143 28791 51594 49641 56607
49195 44021 2...

result:

wrong answer the sum of the elements in your matrix is 25039704, but jury's plan is 18759816