# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
49832 | A_H_Ghaznavi | Automobil (COCI17_automobil) | C++14 | 515 ms | 17176 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// 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 |
---|---|---|---|---|
Fetching results... |