Submission #314467

#TimeUsernameProblemLanguageResultExecution timeMemory
314467FlashGamezzzAutomobil (COCI17_automobil)C++17
50 / 100
28 ms8224 KiB
#include <iostream> #include <cstdlib> #include <cstdio> #include <fstream> #include <algorithm> #include <string> using namespace std; long long n, m, k, mod = 1000000007; long long rp[1000000], cp[1000], cs = 0, sum = 0, ans = 0; int main() { ios_base::sync_with_stdio(false); cin >> n >> m >> k; for (int i = 0; i < n; i++){ rp[i] = 1; } for (int i = 0; i < m; i++){ cp[i] = 1; } for (int i = 0; i < k; i++){ string r; cin >> r; long long x, y; cin >> x >> y; if (r.compare("R") == 0){ rp[x-1] *= y; rp[x-1] %= mod; } else { cp[x-1] *= y; cp[x-1] %= mod; } } for (long long i = 0; i < m; i++){ cs += cp[i]; sum += (i+1)*cp[i]; sum %= mod; } for (long long i = 0; i < n; i++){ ans += sum*rp[i]; ans %= mod; sum += cs*m; sum %= mod; } cout << ans << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...