#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <climits>
#include <cmath>
#include <fstream>
#include <queue>
using namespace std;
#define MOD 1000000007
#define MAXN 1000005
int main() {
long long n, m, k;
cin >> n >> m >> k;
long long rows[MAXN], cols[MAXN];
for (int i = 0; i < MAXN; i++) {
rows[i] = 1;
cols[i] = 1;
}
for (int i = 0; i < k; i++) {
char c;
long long a, b;
cin >> c >> a >> b;
if (c == 'R') {
rows[a] = (rows[a]*b + MOD)%MOD;
}
else {
cols[a] = (cols[a] * b + MOD) % MOD;
}
}
long long num1 = 0, num2 = 0;
for (int i = 1; i <= m; i++) {
num1 = (num1 + cols[i] + MOD) % MOD;
num2 = (num2 + i * cols[i] + MOD) % MOD;
}
long long ans = 0;
for (int i = 1; i <= n; i++) {
ans = (ans + rows[i]*(num2 + (i - 1)*m*num1) + MOD) % MOD;
}
cout << ans << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
12 ms |
16000 KB |
Output isn't correct |
2 |
Incorrect |
10 ms |
16000 KB |
Output isn't correct |
3 |
Incorrect |
11 ms |
16000 KB |
Output isn't correct |
4 |
Incorrect |
11 ms |
16000 KB |
Output isn't correct |
5 |
Incorrect |
11 ms |
16000 KB |
Output isn't correct |
6 |
Incorrect |
10 ms |
16000 KB |
Output isn't correct |
7 |
Incorrect |
10 ms |
16000 KB |
Output isn't correct |
8 |
Incorrect |
11 ms |
16000 KB |
Output isn't correct |
9 |
Incorrect |
10 ms |
16000 KB |
Output isn't correct |
10 |
Incorrect |
11 ms |
16000 KB |
Output isn't correct |
11 |
Incorrect |
13 ms |
16000 KB |
Output isn't correct |
12 |
Incorrect |
17 ms |
16000 KB |
Output isn't correct |
13 |
Incorrect |
11 ms |
16000 KB |
Output isn't correct |
14 |
Incorrect |
16 ms |
16000 KB |
Output isn't correct |
15 |
Incorrect |
17 ms |
16000 KB |
Output isn't correct |
16 |
Incorrect |
23 ms |
16000 KB |
Output isn't correct |
17 |
Incorrect |
22 ms |
16000 KB |
Output isn't correct |
18 |
Incorrect |
22 ms |
16000 KB |
Output isn't correct |
19 |
Incorrect |
22 ms |
16000 KB |
Output isn't correct |
20 |
Incorrect |
22 ms |
16000 KB |
Output isn't correct |