QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#487095#4786. BalancePlentyOfPenaltyWA 1ms5780kbC++171.1kb2024-07-22 16:10:502024-07-22 16:10:50

Judging History

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

  • [2024-07-22 16:10:50]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5780kb
  • [2024-07-22 16:10:50]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

#define N 1010

ll n, m;
ll a[N][N], s[N][N];
ll w[N];

int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    cin >> n;
    for (int i = 1; i <= n; i ++)
    {
        for (int j = 1; j <= n; j ++)
        {
            cin >> a[i][j];
        }
    }
    for (int i = 1; i <= n; i ++)
    {
        w[i] = a[i][1];
        for (int j = 1; j <= n; j ++)
        {
            a[i][j] -= w[i];
        }
    }
    for (int j = 2; j <= n; j ++)
    {
        ll mx = 0;
        for (int i = 1; i <= n; i ++)
        {
            mx = max(mx, a[i][j]);
        }
        for (int i = 1; i <= n; i ++)a[i][j] = mx;
    }
    for (int i = 1; i <= n; i ++)
    {
        for (int j = 1; j <= n; j ++)a[i][j] += w[i];
    }
    ll ans = 0;
    for (int i = 1; i <= n; i ++) for (int j = 1; j <= n; j ++) ans += a[i][j];
    cout << ans << '\n';
    for (int i = 1; i <= n; i ++)
    {
        for (int j = 1; j <= n; j ++) cout << a[i][j] << ' ';
        cout << '\n';
    }
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 5780kb

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

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:

22778352
20594 47278 53212 37726 41055 46235 46298 41934 39179 46950 48986 35517 38831 46856 41468 42819 41490 46227 50744 45700 40063 46234 41025 46655 
15252 41936 47870 32384 35713 40893 40956 36592 33837 41608 43644 30175 33489 41514 36126 37477 36148 40885 45402 40358 34721 40892 35683 41313 
2...

result:

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