| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 471727 | rainboy | Automobil (COCI17_automobil) | C11 | 18 ms | 8120 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 <stdio.h>
#define N	1000000
#define M	1000000
#define MD	1000000007
int main() {
	static int aa[N], bb[M];
	int n, m, k, i, j, a, b, c, d;
	scanf("%d%d%d", &n, &m, &k);
	for (i = 0; i < n; i++)
		aa[i] = 1;
	for (j = 0; j < m; j++)
		bb[j] = 1;
	while (k--) {
		static char s[2];
		int x;
		scanf("%s", s);
		if (s[0] == 'R') {
			scanf("%d%d", &i, &x), i--;
			aa[i] = (long long) aa[i] * x % MD;
		} else {
			scanf("%d%d", &j, &x), j--;
			bb[j] = (long long) bb[j] * x % MD;
		}
	}
	/* (i m + j + 1) aa[i] bb[j] = (i aa[i] bb[j]) m + (j bb[j] aa[i]) + aa[i] bb[j] */
	a = 0, c = 0;
	for (i = 0; i < n; i++)
		a = (a + aa[i]) % MD, c = (c + (long long) aa[i] * i) % MD;
	b = 0, d = 0;
	for (j = 0; j < m; j++)
		b = (b + bb[j]) % MD, d = (d + (long long) bb[j] * j) % MD;
	printf("%lld\n", ((long long) b * c % MD * m % MD + (long long) a * d % MD + (long long) a * b % MD) % MD);
	return 0;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
