#include <bits/stdc++.h>
#define int long long
using namespace std;
const int mod = 1e9+7;
int n,m,k,x,y,z;
int ar[1005][1005];
char ch;
signed main() {
cin >> n >> m >> k;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
ar[i][j] = ++x;
}
}
for (int i = 1; i <= k; i++) {
cin >> ch >> x >> y;
if (ch == 'R') {
for (int i = 1; i <= m; i++) ar[x][i] *= y, ar[x][i] %= mod;
} else {
for (int i = 1; i <= n; i++) ar[i][x] *= y, ar[i][x] %= mod;
}
}
int ans = 0;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) ans += ar[i][j];
}
cout << (ans % mod) << "\n";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
724 KB |
Output is correct |
2 |
Correct |
3 ms |
3028 KB |
Output is correct |
3 |
Correct |
1 ms |
2004 KB |
Output is correct |
4 |
Correct |
1 ms |
852 KB |
Output is correct |
5 |
Correct |
4 ms |
6996 KB |
Output is correct |
6 |
Correct |
2 ms |
2260 KB |
Output is correct |
7 |
Correct |
5 ms |
6832 KB |
Output is correct |
8 |
Correct |
3 ms |
4820 KB |
Output is correct |
9 |
Correct |
3 ms |
3924 KB |
Output is correct |
10 |
Correct |
4 ms |
3924 KB |
Output is correct |
11 |
Runtime error |
62 ms |
16376 KB |
Execution killed with signal 11 |
12 |
Runtime error |
105 ms |
16336 KB |
Execution killed with signal 11 |
13 |
Runtime error |
45 ms |
16408 KB |
Execution killed with signal 11 |
14 |
Runtime error |
94 ms |
16332 KB |
Execution killed with signal 11 |
15 |
Runtime error |
112 ms |
16332 KB |
Execution killed with signal 11 |
16 |
Runtime error |
17 ms |
16388 KB |
Execution killed with signal 11 |
17 |
Runtime error |
18 ms |
16328 KB |
Execution killed with signal 11 |
18 |
Runtime error |
20 ms |
16396 KB |
Execution killed with signal 11 |
19 |
Runtime error |
22 ms |
16340 KB |
Execution killed with signal 11 |
20 |
Runtime error |
17 ms |
16440 KB |
Execution killed with signal 11 |