# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
631611 | Justin1 | Automobil (COCI17_automobil) | C++14 | 95 ms | 8428 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;
int n,m,k,x,y,z;
int ar[1005][1005];
char ch;
int main() {
cin >> n >> m >> k;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
ar[i][j] = ++x;
}
}
for (int i = 1; i <= k; i++) {
cin >> ch >> x >> y;
if (ch == 'R') {
for (int i = 1; i <= m; i++) ar[x][i] *= y, ar[x][i] %= mod;
} else {
for (int i = 1; i <= n; i++) ar[i][x] *= y, ar[i][x] %= mod;
}
}
int ans = 0;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) ans += ar[i][j];
}
cout << (ans % mod) << "\n";
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |