# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1090877 | 2024-09-19T01:54:10 Z | vjudge1 | Automobil (COCI17_automobil) | C++17 | 17 ms | 16132 KB |
#include <iostream> typedef long long ll; const int LEN = 1'000'001; const ll MOD = 1e9 + 7; int N, M, K; ll R[LEN], C[LEN]; char c; int main() { std::cin.tie(0)->sync_with_stdio(0); std::cin >> N >> M >> K; for (int i = 1; i <= N; ++i) R[i] = 1; for (int i = 1; i <= M; ++i) C[i] = 1; for (int i = 0, k, x, y; i < K; ++i) { std::cin >> c >> x >> y; if (c == 'R') R[x] = R[x] * y % MOD; else C[x] = C[x] * y % MOD; } // column process ll eff = 0; ll sum = 0; for (int i = 1; i <= M; ++i) { eff = (eff + C[i]) % MOD; sum = (sum + C[i] * i) % MOD; } // row proces ll ret = 0; for (ll i = 1; i <= N; ++i) ret = (ret + ((i - 1) * M % MOD * eff % MOD + sum) % MOD * R[i]) % MOD; std::cout << ret; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 436 KB | Output is correct |
8 | Correct | 0 ms | 468 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 3 ms | 2908 KB | Output is correct |
12 | Correct | 9 ms | 8796 KB | Output is correct |
13 | Correct | 1 ms | 856 KB | Output is correct |
14 | Correct | 11 ms | 10248 KB | Output is correct |
15 | Correct | 9 ms | 9196 KB | Output is correct |
16 | Correct | 16 ms | 15964 KB | Output is correct |
17 | Correct | 16 ms | 15960 KB | Output is correct |
18 | Correct | 16 ms | 16132 KB | Output is correct |
19 | Correct | 17 ms | 15964 KB | Output is correct |
20 | Correct | 16 ms | 16128 KB | Output is correct |