#include<bits/stdc++.h>
using namespace std;
#define TEST 0
#define DEFINE_MOD 1
#if TEST == 1
ifstream din("C:\\code\\C++\\Project1\\Project1\\Input.txt");
ofstream dout("C:\\code\\C++\\Project1\\Project1\\Output.txt");
#else
#define din cin
#define dout cout
#endif
#if DEFINE_MOD == 1
#define ll long long
#define fi first
#define se second
#define ii pair<int,int>
#define il pair<int,ll>
#define For(i,a,b) for(int i = a; i < b; ++i)
#define Forr(i,a,b) for(int i = a; i <= b; ++i)
#define Rep(i,a,b) for(int i = a; i > b; --i)
#define Repr(i,a,b) for(int i = a; i >= b; --i)
ll oo = 1e18 + 32;
ll mod = 1e9 + 7;
#else
#endif
int n, m,k;
vector<ll> R, S;
void Input() {
din >> n >> m>>k;
}
void Build() {
R.resize(n + 7, 1);
S.resize(m + 7, 1);
while (k--) {
char type; din >> type;
int id, val; din >> id >> val;
if (type == 'R') {
R[id] = (R[id] % mod * val % mod) % mod;
}
else S[id] = (S[id] % mod * val % mod) % mod;
}
}
void Output() {
ll P1 = 0;
ll P2 = 0;
Forr(i, 1, n) P1 = (P1 % mod + R[i] % mod) % mod;
Forr(i, 1, m) P2 = (P2 % mod + S[i] % mod) % mod;
dout << (P1 % mod * P2 % mod) % mod;
}
int main() {
ios_base::sync_with_stdio(false); cin.tie(NULL);
Input();
Build();
Output();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
352 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
6 |
Incorrect |
1 ms |
420 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
8 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
10 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
11 |
Incorrect |
4 ms |
2916 KB |
Output isn't correct |
12 |
Incorrect |
14 ms |
8792 KB |
Output isn't correct |
13 |
Incorrect |
1 ms |
860 KB |
Output isn't correct |
14 |
Incorrect |
15 ms |
10076 KB |
Output isn't correct |
15 |
Incorrect |
13 ms |
9192 KB |
Output isn't correct |
16 |
Incorrect |
23 ms |
15964 KB |
Output isn't correct |
17 |
Incorrect |
23 ms |
15960 KB |
Output isn't correct |
18 |
Incorrect |
24 ms |
15960 KB |
Output isn't correct |
19 |
Incorrect |
24 ms |
15960 KB |
Output isn't correct |
20 |
Incorrect |
22 ms |
15960 KB |
Output isn't correct |