Submission #314468

#TimeUsernameProblemLanguageResultExecution timeMemory
314468FlashGamezzzAutomobil (COCI17_automobil)C++17
100 / 100
35 ms16000 KiB
#include <iostream> #include <cstdlib> #include <cstdio> #include <fstream> #include <algorithm> #include <string> using namespace std; int n, m, k, mod = 1000000007; long rp[1000000], cp[1000000], 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; int 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 (int i = 0; i < m; i++){ cs += cp[i]; cs %= mod; sum += (i+1)*cp[i]; sum %= mod; } for (int 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...