# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
199947 | Osama_Alkhodairy | Automobil (COCI17_automobil) | C++17 | 36 ms | 8184 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define finish(x) return cout << x << endl, 0
#define ll long long
const int N = 1000001;
int n, m, k, row[N], col[N], mod = 1e9 + 7;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n >> m >> k;
for(int i = 1 ; i <= max(n, m) ; i++){
row[i] = col[i] = 1;
}
for(int i = 0 ; i < k ; i++){
char c;
int x, y;
cin >> c >> x >> y;
if(c == 'R') row[x] = 1LL * row[x] * y % mod;
else col[x] = 1LL * col[x] * y % mod;
}
int sc = 0;
for(int j = 1 ; j <= m ; j++){
sc = (sc + col[j]) % mod;
}
int ans = 0;
int cur = 0;
for(int j = 1 ; j <= m ; j++){
cur = (cur + 1LL * col[j] * j) % mod;
}
for(int i = 1 ; i <= n ; i++){
ans = (ans + 1LL * cur * row[i]) % mod;
cur = (cur + 1LL * sc * m) % mod;
}
cout << ans << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |