#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1000000007;
int main()
{
ll n,m,k;cin>>n>>m>>k;
vector<vector<ll>>arr(n,vector<ll>(m));
ll u=1;
for(ll i=0;i<n;i++){
for(ll j=0;j<m;j++){
arr[i][j]=(u++);
}
}
while(k--){
char c;
ll x,y;cin>>c>>x>>y;
if(c=='R'){
for(ll i=0;i<m;i++){
arr[x-1][i]*=y;
arr[x-1][i]%=mod;
}
}
else{
for(ll i=0;i<n;i++){
arr[i][x-1]*=y;
arr[i][x-1]%=mod;
}
}
}
ll ans=0;
for(ll i=0;i<n;i++){
for(ll j=0;j<m;j++){
ans+=arr[i][j];
ans%=mod;
}
}
cout<<ans<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
716 KB |
Output is correct |
2 |
Correct |
8 ms |
2892 KB |
Output is correct |
3 |
Correct |
2 ms |
844 KB |
Output is correct |
4 |
Correct |
4 ms |
460 KB |
Output is correct |
5 |
Correct |
8 ms |
3596 KB |
Output is correct |
6 |
Correct |
4 ms |
1920 KB |
Output is correct |
7 |
Correct |
11 ms |
3660 KB |
Output is correct |
8 |
Correct |
5 ms |
1740 KB |
Output is correct |
9 |
Correct |
8 ms |
2764 KB |
Output is correct |
10 |
Correct |
11 ms |
3660 KB |
Output is correct |
11 |
Runtime error |
36 ms |
65540 KB |
Execution killed with signal 9 |
12 |
Runtime error |
36 ms |
65540 KB |
Execution killed with signal 9 |
13 |
Runtime error |
40 ms |
65540 KB |
Execution killed with signal 9 |
14 |
Runtime error |
34 ms |
65540 KB |
Execution killed with signal 9 |
15 |
Runtime error |
39 ms |
65540 KB |
Execution killed with signal 9 |
16 |
Runtime error |
34 ms |
65540 KB |
Execution killed with signal 9 |
17 |
Runtime error |
37 ms |
65540 KB |
Execution killed with signal 9 |
18 |
Runtime error |
39 ms |
65540 KB |
Execution killed with signal 9 |
19 |
Runtime error |
38 ms |
65540 KB |
Execution killed with signal 9 |
20 |
Runtime error |
37 ms |
65540 KB |
Execution killed with signal 9 |