답안 #631606

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
631606 2022-08-18T09:56:04 Z Justin1 Automobil (COCI17_automobil) C++14
0 / 100
30 ms 16004 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;

int n,m,k,x,y,z;
int c[1000005], r[1000005];
char ch;
vector<int> colupd;

int mod(int x) {
	const int modval = 1e9+7;
	return ((x % modval) + modval) % modval;
}

signed main() {
	cin.tie(0), cout.tie(0) -> sync_with_stdio(0);
	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 = 1; i <= k; i++) {
		cin >> ch >> x >> y;
		if (ch == 'R') r[x] = mod(r[x] * y);
		else c[x] = mod(c[x] * y);
	}
	int ans = mod((1 + n*m) * (n*m) / 2);
	for (int i = 1; i <= m; i++) {
		if (c[i] != 1) colupd.push_back(i);
		ans += mod((n*(2*i+(n-1)*m)/2) * (c[i]-1));
		ans = mod(ans);
	}
	for (int i = 1; i <= n; i++) {
		int st = m*(i-1)+1;
		ans += mod((m*(2*st+m-1)/2) * (r[i]-1));
		if (r[i] != 1) {
			for (auto j : colupd) {
				int val = m*(i-1) + j;
				ans -= mod(val * (r[i]-1 + c[j]-1));
				ans += mod(val * (r[i] * c[j] - 1));
			}
		}
		ans = mod(ans);
	}
	cout << ans << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Incorrect 1 ms 340 KB Output isn't correct
3 Incorrect 1 ms 340 KB Output isn't correct
4 Incorrect 1 ms 336 KB Output isn't correct
5 Incorrect 1 ms 340 KB Output isn't correct
6 Incorrect 1 ms 340 KB Output isn't correct
7 Incorrect 1 ms 340 KB Output isn't correct
8 Incorrect 1 ms 340 KB Output isn't correct
9 Incorrect 1 ms 340 KB Output isn't correct
10 Incorrect 1 ms 340 KB Output isn't correct
11 Incorrect 4 ms 2772 KB Output isn't correct
12 Incorrect 15 ms 8736 KB Output isn't correct
13 Incorrect 2 ms 852 KB Output isn't correct
14 Incorrect 14 ms 10108 KB Output isn't correct
15 Incorrect 16 ms 9044 KB Output isn't correct
16 Incorrect 25 ms 15992 KB Output isn't correct
17 Incorrect 25 ms 15956 KB Output isn't correct
18 Incorrect 30 ms 15900 KB Output isn't correct
19 Incorrect 27 ms 15956 KB Output isn't correct
20 Incorrect 26 ms 16004 KB Output isn't correct