#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll base = 1e9 + 7;
int row[1010], col[1010];
void mul(int &x, int y) { (x *= 1ll * y) %= base; }
void sum(int &x, int y) { (x += 1ll * y) %= base; }
int main() {
int n, m, q;
cin >> n >> m >> q;
for (int i = 1; i <= n; ++i)
row[i] = 1;
for (int j = 1; j <= m; ++j)
col[j] = 1;
while (q--) {
char type; int x, y;
cin >> type >> x >> y;
--x;
if (type == 'R') mul(row[x], y);
else mul(col[x], y);
}
int ans = 0;
for (int i = 1; i <= n; ++i)
for (int j = 1; j <= m; ++j) {
int rw = row[i], cl = col[j];
int vl = (i - 1) * m + j;
mul(rw, cl);
mul(vl, rw);
sum(ans, vl);
}
cout << ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
256 KB |
Output isn't correct |
2 |
Incorrect |
7 ms |
256 KB |
Output isn't correct |
3 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
4 |
Incorrect |
5 ms |
256 KB |
Output isn't correct |
5 |
Incorrect |
8 ms |
256 KB |
Output isn't correct |
6 |
Incorrect |
6 ms |
384 KB |
Output isn't correct |
7 |
Incorrect |
9 ms |
256 KB |
Output isn't correct |
8 |
Incorrect |
6 ms |
256 KB |
Output isn't correct |
9 |
Incorrect |
7 ms |
384 KB |
Output isn't correct |
10 |
Incorrect |
9 ms |
256 KB |
Output isn't correct |
11 |
Runtime error |
5 ms |
384 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
12 |
Runtime error |
5 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
13 |
Runtime error |
5 ms |
384 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
14 |
Runtime error |
5 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
15 |
Runtime error |
5 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
16 |
Runtime error |
5 ms |
384 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
17 |
Runtime error |
5 ms |
384 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
18 |
Runtime error |
5 ms |
384 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
19 |
Runtime error |
5 ms |
384 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
20 |
Runtime error |
5 ms |
384 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |