Submission #475413

# Submission time Handle Problem Language Result Execution time Memory
475413 2021-09-22T09:39:58 Z Ahmed57 Automobil (COCI17_automobil) C++14
50 / 100
47 ms 65540 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
int mod = 1000000007;
signed main()
{
    int n,m,k;
    cin>>n>>m>>k;
    int arr[n][m];
    for(int i = 0;i<n;i++){
        for(int j = 0;j<m;j++){
            arr[i][j] = (i*m)+j+1;
        }
    }
    while(k--){
        char c;
        int a,b;
        cin>>c>>a>>b;a--;
        if(c=='R'){
            for(int i = 0;i<m;i++){
                arr[a][i]*=b%mod;
                arr[a][i]%=mod;
            }
        }else{
            for(int i = 0;i<n;i++){
                arr[i][a]*=b%mod;
                arr[i][a]%=mod;
            }
        }
    }
    int ans = 0;
    for(int i = 0;i<n;i++){
        for(int j = 0;j<m;j++){
            ans+=arr[i][j];
            ans%=mod;
        }
    }cout<<ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 716 KB Output is correct
2 Correct 8 ms 2872 KB Output is correct
3 Correct 2 ms 844 KB Output is correct
4 Correct 4 ms 460 KB Output is correct
5 Correct 8 ms 3532 KB Output is correct
6 Correct 5 ms 1868 KB Output is correct
7 Correct 12 ms 3712 KB Output is correct
8 Correct 5 ms 1740 KB Output is correct
9 Correct 8 ms 2764 KB Output is correct
10 Correct 11 ms 3712 KB Output is correct
11 Runtime error 35 ms 65540 KB Execution killed with signal 9
12 Runtime error 40 ms 65540 KB Execution killed with signal 9
13 Runtime error 40 ms 65540 KB Execution killed with signal 9
14 Runtime error 34 ms 65540 KB Execution killed with signal 9
15 Runtime error 47 ms 65536 KB Execution killed with signal 9
16 Runtime error 37 ms 65540 KB Execution killed with signal 9
17 Runtime error 36 ms 65540 KB Execution killed with signal 9
18 Runtime error 34 ms 65540 KB Execution killed with signal 9
19 Runtime error 37 ms 65540 KB Execution killed with signal 9
20 Runtime error 33 ms 65540 KB Execution killed with signal 9