# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
199946 | Osama_Alkhodairy | Automobil (COCI17_automobil) | C++17 | 36 ms | 8184 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;
#define finish(x) return cout << x << endl, 0
#define ll long long
const int N = 1000001;
int n, m, k, row[N], col[N], mod = 1e9 + 7;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n >> m >> k;
for(int i = 1 ; i <= max(n, m) ; i++){
row[i] = col[i] = 1;
}
for(int i = 0 ; i < k ; i++){
char c;
int x, y;
cin >> c >> x >> y;
if(c == 'R') row[x] = 1LL * row[x] * y % mod;
else col[x] = 1LL * col[x] * y;
}
int sc = 0;
for(int j = 1 ; j <= m ; j++){
sc = (sc + col[j]) % mod;
}
int ans = 0;
int cur = 0;
for(int j = 1 ; j <= m ; j++){
cur = (cur + 1LL * col[j] * j) % mod;
}
for(int i = 1 ; i <= n ; i++){
ans = (ans + 1LL * cur * row[i]) % mod;
cur = (cur + 1LL * sc * m) % mod;
}
cout << ans << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |