# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
81268 | ngot23 | Automobil (COCI17_automobil) | C++11 | 34 ms | 16228 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define rep(i, a, b) for(long long i=(a) ; i<=(b) ; ++i)
#define Task ""
using namespace std;
const int N=1000005;
const int mod=1000000007;
long long col[N], row[N], m, n, k;
int main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//freopen(Task".inp", "r", stdin);
//freopen(Task".out", "w", stdout);
cin >> m >> n >> k;
rep(i, 1, m) row[i]=1;
rep(i, 1, n) col[i]=1;
rep(i, 1, k) {
char c;
long long x, y;
cin >> c >> x >> y;
if(c=='R') (row[x]*=y)%=mod;
else (col[x]*=y)%=mod;
}
long long val1=0, val2=0;
rep(i, 1, n) {
val1=(val1+1ll*col[i]*i)%mod;
val2=(val2+1ll*col[i]*n)%mod;
}
long long ans=0;
rep(i, 1, m) {
long long xx=(1ll*(i-1)*val2)%mod;
ans=(((0ll+val1+xx) % mod)*row[i]+ans)%mod;
}
cout << ans;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |