# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
475412 | Ahmed_Solyman | Automobil (COCI17_automobil) | C++14 | 39 ms | 65540 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.
#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(auto i:arr){
for(auto j:i){
ans+=j;
}
}
cout<<ans<<endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |