| Task: | Ruudukko |
| Sender: | Yytsi |
| Submission time: | 2025-12-20 15:42:54 +0200 |
| Language: | C++ (C++20) |
| Status: | READY |
| Result: | 100 |
| group | verdict | score |
|---|---|---|
| #1 | ACCEPTED | 13 |
| #2 | ACCEPTED | 36 |
| #3 | ACCEPTED | 51 |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | ACCEPTED | 0.00 s | 1, 2, 3 | details |
| #2 | ACCEPTED | 0.01 s | 2, 3 | details |
| #3 | ACCEPTED | 0.19 s | 3 | details |
Code
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int n;
ll a[1010][1010];
ll M = 1000000007LL;
int main() {
ios_base::sync_with_stdio(0); cin.tie(0);
cin>>n;
for (int y = 0; y < n; y++) {
for (int x = 0; x < n; x++) {
cin>>a[y][x];
}
}
ll ans = 0;
for (int y = 0; y < n; y++) {
for (int x = 0; x < n; x++) {
ll add = (y+1LL) * (x+1LL);
add %= M;
add *= ll(n) - ll(x);
add %= M;
add *= ll(n) - ll(y);
add %= M;
add *= a[y][x];
add %= M;
ans += add;
ans %= M;
}
}
if (ans < 0LL) ans += M;
cout << ans << "\n";
}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 |
