Submission #1090875

# Submission time Handle Problem Language Result Execution time Memory
1090875 2024-09-19T01:52:31 Z vjudge1 Automobil (COCI17_automobil) C++17
55 / 100
18 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 (int i = 1; i <= N; ++i)
		ret = (ret + ((i - 1) * M % MOD * eff % MOD + sum) % MOD * R[i]) % MOD;
	std::cout << ret;
}

Compilation message

automobil.cpp: In function 'int main()':
automobil.cpp:17:18: warning: unused variable 'k' [-Wunused-variable]
   17 |  for (int i = 0, k, x, y; i < K; ++i) {
      |                  ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Incorrect 3 ms 2904 KB Output isn't correct
12 Incorrect 9 ms 8860 KB Output isn't correct
13 Correct 1 ms 860 KB Output is correct
14 Incorrect 11 ms 10248 KB Output isn't correct
15 Incorrect 11 ms 9052 KB Output isn't correct
16 Incorrect 17 ms 15980 KB Output isn't correct
17 Incorrect 17 ms 16132 KB Output isn't correct
18 Incorrect 17 ms 15960 KB Output isn't correct
19 Incorrect 18 ms 16092 KB Output isn't correct
20 Incorrect 17 ms 15960 KB Output isn't correct