// In the name of god
// A.H.Ghaznavi
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1000000007;
ll n,m,k,x,y,jadval[1010][1010],ans;
char c;
int main()
{
cin>>n>>m>>k;
for (int i=0;i<n;i++)
{
for (int i2=0;i2<m;i2++)
jadval[i][i2]=((m*i+i2+1)+mod)%mod;
}
for (int i=0;i<k;i++)
{
cin>>c>>x>>y;
if (c=='R')
{
for (int i2=0;i2<m;i2++)
{
jadval[x-1][i2]*=y;
jadval[x-1][i2]+=mod;
jadval[x-1][i2]%=mod;
}
}
else
{
for (int i2=0;i2<n;i2++)
{
jadval[i2][x-1]*=y;
jadval[i2][x-1]+=mod;
jadval[i2][x-1]%=mod;
}
}
}
for (int i=0;i<n;i++)
{
for (int i2=0;i2<m;i2++)
{
ans+=jadval[i][i2];
ans+=mod;
ans%=mod;
}
}
cout<<ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
760 KB |
Output is correct |
2 |
Correct |
9 ms |
3192 KB |
Output is correct |
3 |
Correct |
4 ms |
3192 KB |
Output is correct |
4 |
Correct |
4 ms |
3192 KB |
Output is correct |
5 |
Correct |
13 ms |
7304 KB |
Output is correct |
6 |
Correct |
5 ms |
7304 KB |
Output is correct |
7 |
Correct |
20 ms |
7304 KB |
Output is correct |
8 |
Correct |
8 ms |
7304 KB |
Output is correct |
9 |
Correct |
8 ms |
7304 KB |
Output is correct |
10 |
Correct |
11 ms |
7304 KB |
Output is correct |
11 |
Runtime error |
224 ms |
17036 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
12 |
Runtime error |
456 ms |
17036 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
13 |
Runtime error |
113 ms |
17036 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
14 |
Runtime error |
456 ms |
17092 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
15 |
Runtime error |
515 ms |
17092 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
16 |
Runtime error |
64 ms |
17092 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
17 |
Runtime error |
64 ms |
17092 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
18 |
Runtime error |
60 ms |
17176 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
19 |
Runtime error |
60 ms |
17176 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
20 |
Runtime error |
68 ms |
17176 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |