Submission #199946

# Submission time Handle Problem Language Result Execution time Memory
199946 2020-02-04T10:26:43 Z Osama_Alkhodairy Automobil (COCI17_automobil) C++17
30 / 100
36 ms 8184 KB
#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
1 Incorrect 5 ms 376 KB Output isn't correct
2 Incorrect 6 ms 376 KB Output isn't correct
3 Incorrect 5 ms 376 KB Output isn't correct
4 Incorrect 5 ms 376 KB Output isn't correct
5 Incorrect 5 ms 376 KB Output isn't correct
6 Incorrect 5 ms 376 KB Output isn't correct
7 Incorrect 5 ms 376 KB Output isn't correct
8 Incorrect 5 ms 376 KB Output isn't correct
9 Incorrect 5 ms 376 KB Output isn't correct
10 Incorrect 5 ms 376 KB Output isn't correct
11 Correct 10 ms 1784 KB Output is correct
12 Correct 22 ms 5752 KB Output is correct
13 Incorrect 6 ms 760 KB Output isn't correct
14 Correct 26 ms 7032 KB Output is correct
15 Incorrect 22 ms 5112 KB Output isn't correct
16 Incorrect 35 ms 8184 KB Output isn't correct
17 Incorrect 35 ms 8056 KB Output isn't correct
18 Correct 36 ms 8184 KB Output is correct
19 Correct 35 ms 8184 KB Output is correct
20 Correct 35 ms 8184 KB Output is correct