#include<bits/stdc++.h>
#define rep(i, a, b) for(long long i=(a) ; i<=(b) ; ++i)
#define Task ""
using namespace std;
const int N=1000005;
const int mod=1000000007;
long long col[N], row[N], m, n, k;
int main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//freopen(Task".inp", "r", stdin);
//freopen(Task".out", "w", stdout);
cin >> m >> n >> k;
rep(i, 1, m) row[i]=1;
rep(i, 1, n) col[i]=1;
rep(i, 1, k) {
char c;
long long x, y;
cin >> c >> x >> y;
if(c=='R') row[x]*=y;
else col[x]*=y;
}
long long val1=0, val2=0;
rep(i, 1, n) {
val1=(val1+1ll*col[i]*i)%mod;
val2=(val2+1ll*col[i]*n)%mod;
}
long long ans=0;
rep(i, 1, m) {
long long xx=(1ll*(i-1)*val2)%mod;
ans=(((0ll+val1+xx) % mod)*row[i]+ans)%mod;
}
cout << ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
376 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
444 KB |
Output isn't correct |
3 |
Incorrect |
2 ms |
444 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
492 KB |
Output isn't correct |
5 |
Incorrect |
2 ms |
532 KB |
Output isn't correct |
6 |
Incorrect |
2 ms |
628 KB |
Output isn't correct |
7 |
Incorrect |
2 ms |
628 KB |
Output isn't correct |
8 |
Incorrect |
2 ms |
628 KB |
Output isn't correct |
9 |
Incorrect |
2 ms |
672 KB |
Output isn't correct |
10 |
Incorrect |
2 ms |
672 KB |
Output isn't correct |
11 |
Correct |
6 ms |
2992 KB |
Output is correct |
12 |
Correct |
16 ms |
9008 KB |
Output is correct |
13 |
Incorrect |
4 ms |
9008 KB |
Output isn't correct |
14 |
Correct |
18 ms |
10348 KB |
Output is correct |
15 |
Incorrect |
17 ms |
10348 KB |
Output isn't correct |
16 |
Incorrect |
28 ms |
16492 KB |
Output isn't correct |
17 |
Incorrect |
31 ms |
16492 KB |
Output isn't correct |
18 |
Incorrect |
27 ms |
16492 KB |
Output isn't correct |
19 |
Correct |
27 ms |
16492 KB |
Output is correct |
20 |
Incorrect |
28 ms |
16492 KB |
Output isn't correct |