# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
314468 | FlashGamezzz | Automobil (COCI17_automobil) | C++17 | 35 ms | 16000 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 <iostream>
#include <cstdlib>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <string>
using namespace std;
int n, m, k, mod = 1000000007;
long rp[1000000], cp[1000000], cs = 0, sum = 0, ans = 0;
int main() {
ios_base::sync_with_stdio(false);
cin >> n >> m >> k;
for (int i = 0; i < n; i++){
rp[i] = 1;
}
for (int i = 0; i < m; i++){
cp[i] = 1;
}
for (int i = 0; i < k; i++){
string r; cin >> r;
int x, y; cin >> x >> y;
if (r.compare("R") == 0){
rp[x-1] *= y; rp[x-1] %= mod;
} else {
cp[x-1] *= y; cp[x-1] %= mod;
}
}
for (int i = 0; i < m; i++){
cs += cp[i]; cs %= mod;
sum += (i+1)*cp[i]; sum %= mod;
}
for (int i = 0; i < n; i++){
ans += sum*rp[i]; ans %= mod;
sum += cs*m; sum %= mod;
}
cout << ans << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |