답안 #971922

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
971922 2024-04-29T13:55:27 Z vjudge1 Automobil (COCI17_automobil) C++17
50 / 100
1000 ms 15964 KB
#include <bits/stdc++.h>
#pragma GCC optimize ("03")
using namespace std;
using ll = long long;
#define MOD 1000000007
ll n, m, k;
ll power(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1) {
            res = (res * a) % MOD;
        }
        a = (a * a) % MOD;
        b >>= 1;
    }
    return res;
}

int main() {
    cin >> n >> m >> k;
    vector<ll> row(n + 1, 1), col(m + 1, 1);
    while (k--) {
        char type;
        ll x, y;
        cin >> type >> x >> y;
        if (type == 'R') {
            row[x] = (row[x] * y) % MOD;
        } else {
            col[x] = (col[x] * y) % MOD;
        }
    }

    ll sum = 0;
    for (ll i = 1; i <= n; i++) {
        for (ll j = 1; j <= m; j++) {
            sum = (sum + ((i*m + j - m) * row[i] % MOD * col[j] % MOD)) % MOD;
        }
    }

    cout << sum << "\n";
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 3 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 2 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 3 ms 348 KB Output is correct
10 Correct 4 ms 404 KB Output is correct
11 Execution timed out 1045 ms 2652 KB Time limit exceeded
12 Execution timed out 1031 ms 8796 KB Time limit exceeded
13 Execution timed out 1024 ms 856 KB Time limit exceeded
14 Execution timed out 1042 ms 10076 KB Time limit exceeded
15 Execution timed out 1091 ms 9048 KB Time limit exceeded
16 Execution timed out 1022 ms 15960 KB Time limit exceeded
17 Execution timed out 1044 ms 15964 KB Time limit exceeded
18 Execution timed out 1062 ms 15964 KB Time limit exceeded
19 Execution timed out 1030 ms 15964 KB Time limit exceeded
20 Execution timed out 1051 ms 15964 KB Time limit exceeded