Submission details
Task:Ruudukko
Sender:sharph2
Submission time:2025-12-20 15:18:45 +0200
Language:C++ (C++17)
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED13
#2ACCEPTED36
#3ACCEPTED51
Test results
testverdicttimegroup
#1ACCEPTED0.00 s1, 2, 3details
#2ACCEPTED0.01 s2, 3details
#3ACCEPTED0.11 s3details

Code

#include <iostream>
#include <climits>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <vector>

using namespace std;

using Z = long long int;

constexpr Z M = 1000000007;

Z mul(Z a, Z b) {
    return a * b % M;
}
Z add(Z a, Z b) {
    return (a + b) % M;
}

int main() {
    cin.sync_with_stdio(false);
    cin.tie(nullptr);

    Z n;
    cin >> n;

    Z ret = 0;
    for(Z y = 0; y < n; ++y) {
        for(Z x = 0; x < n; ++x) {
            Z val;
            cin >> val;
            val = val % M;
            if(val < 0) {
                val += M;
            }
            ret = add(ret, mul(mul(mul(x + 1, y + 1), mul(n - x, n - y)), val));
        }
    }

    cout << ret << "\n";

    return 0;
}

Test details

Test 1

Group: 1, 2, 3

Verdict: ACCEPTED

input
10
647761 970495 559170 744364 38...

correct output
124914206

user output
124914206

Test 2

Group: 2, 3

Verdict: ACCEPTED

input
100
599900 828824 239920 576308 48...

correct output
247718517

user output
247718517

Test 3

Group: 3

Verdict: ACCEPTED

input
1000
130197 933179 613820 209261 72...

correct output
395488302

user output
395488302