# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
44566 | heon | Automobil (COCI17_automobil) | C++11 | 2 ms | 624 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 10001; // kad stavis 1001 compilea, 10001 compilea al sa errorom, 100k+1 nece compileat uopce a trebaju bit dimenzije 1 mil x 1 mil da bi dobio sve bodove...
ll DIV = 1e9 + 7;
ll matrica[MAXN][MAXN];
ll sum = 0, help = 1;
ll red,stup,k;
char up;
ll num1,num2;
int main(){
cin >> red >> stup >> k;
for(int i = 0; i < red; i++){
for(int j = 0; j < stup; j++){
sum += help;
matrica[i][j] = help;
help++;
help %= DIV;
sum %= DIV;
}
}
for(int i = 0; i < k; i++){
cin >> up >> num1 >> num2;
num1--;
if(up == 'R'){
for(int j = 0; j < stup; j++){
sum -= matrica[num1][j];
matrica[num1][j] *= num2;
matrica[num1][j] %= DIV;
sum += matrica[num1][j];
}
}
else{
for(int j = 0; j < red; j++){
sum -= matrica[j][num1];
matrica[j][num1] *= num2;
matrica[j][num1] %= DIV;
sum += matrica[j][num1];
}
}
}
cout << sum % DIV;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |