# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
971974 | vjudge1 | Automobil (COCI17_automobil) | C++17 | 14 ms | 16216 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;
const int MOD = 1e9+7;
const int maxn = 1e6+5;
using ll = long long;
ll r[maxn], c[maxn];
ll ans, n, m, k, sum, sum2;
int main(){
cin >> n >> m >> k;
for(int i = 1; i <= n; i++) r[i] = 1;
for(int i = 1; i <= m; i++) c[i] = 1;
char t;
ll x, y;
while(k--){
cin >> t >> x >> y;
if(t == 'R') r[x] = (r[x] * y) % MOD;
else c[x] = (c[x] * y) % MOD;
}
for(int i = 1; i <= m; i++){
sum += c[i] * i;
sum2 += c[i];
sum %= MOD;
}
sum2 = (sum2 * m) % MOD;
for(int i = 1; i <= n; i++){
ans += (sum * r[i]) % MOD;
ans %= MOD;
sum += sum2;
sum %= MOD;
}
cout << ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |