# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
198593 | ZwariowanyMarcin | Automobil (COCI17_automobil) | C++14 | 21 ms | 8188 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define ss(x) (int) x.size()
#define pb push_back
#define LL long long
#define ld long double
#define cat(x) cerr << #x << " = " << x << endl
#define FOR(i, j, n) for(int i = j; i <= n; ++i)
#define boost cin.tie(0), ios_base::sync_with_stdio(0);
using namespace std;
const int MOD = 1e9 + 7;
const int nax = 1e6 + 111;
int n, m, k;
char c;
int x, y;
int row[nax];
int col[nax];
int main() {
scanf ("%d %d %d", &n, &m, &k);
for (int i = 1; i <= max(n, m); ++i)
row[i] = col[i] = 1;
for (int i = 1; i <= k; ++i) {
scanf (" %c%d%d", &c, &x, &y);
if (c == 'R')
row[x] = 1LL * row[x] * y % MOD;
else
col[x] = 1LL * col[x] * y % MOD;
}
LL ans = 0;
LL value = 0;
LL sum = 0;
for (int i = 1; i <= n; ++i) {
sum = (sum + row[i]) % MOD;
value = (value + 1LL * (1 + 1LL * (i - 1) * m) % MOD * row[i]) % MOD;
}
for (int i = 1; i <= m; ++i) {
ans = (ans + value * col[i]) % MOD;
value = (value + sum) % MOD;
}
printf ("%lld", ans);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |