| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 98105 | dalgerok | Automobil (COCI17_automobil) | C++17 | 23 ms | 8192 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 N = 1e6 + 5, MOD = 1e9 + 7;
int n, m, k, a[N], b[N], ans;
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin >> n >> m >> k;
    for(int i = 1; i <= n; i++){
        b[i] = 1;
    }
    for(int i = 1; i <= m; i++){
        a[i] = 1;
    }
    while(k--){
        char c;
        int x, y;
        cin >> c >> x >> y;
        if(c == 'R'){
            b[x] = 1LL * b[x] * y % MOD;
        }
        else{
            a[x] = 1LL * a[x] * y % MOD;
        }
    }
    int cur1 = 0, cur2 = 0;
    for(int i = 1; i <= m; i++){
        cur1 = (cur1 + 1LL * i * a[i]) % MOD;
        cur2 = (cur2 + 1LL * m * a[i]) % MOD;
    }
    for(int i = 1; i <= n; i++){
        ans = (ans + 1LL * b[i] * (cur1 + 1LL * cur2 * (i - 1) % MOD) % MOD) % MOD;
    }
    cout << ans;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
