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>
#include "arithmetics.h"
using namespace std;
#define pii pair<int, int>
typedef complex<int> point;
signed main(){
cin.tie(NULL);
ios_base::sync_with_stdio(false);
int r, c, q;
cin>>r>>c>>q;
for(int i = 0; i<q; i++){
char p;
cin>>p;
int begin, dest;
cin>>begin>>dest;
if(p == 'K'){
int res= 1;
int n = r-1;
int k = abs(begin-dest);
for(int i =n, j=k; i>n-k; i--, j--){
res= Mul(res, Div(i, j));
}
cout<<(k + r-1)<<" "<<res<<endl;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |