Submission #49832

#TimeUsernameProblemLanguageResultExecution timeMemory
49832A_H_GhaznaviAutomobil (COCI17_automobil)C++14
50 / 100
515 ms17176 KiB
// 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 timeMemoryGrader output
Fetching results...