Won't we be able to choose from (n+m-2*k)C(n-k)? As the number of choices are n-k down and m-k right, and we have to choose n-k options. Also, min(m,n)C(k) are the number of choices for diagonals for each k.
Please correct me if I'm wrong.
Won't we be able to choose from (n+m-2*k)C(n-k)? As the number of choices are n-k down and m-k right, and we have to choose n-k options. Also, min(m,n)C(k) are the number of choices for diagonals for each k.
Please correct me if I'm wrong.
Need help! My solution fails for the some of the testcases in the second subtask(d=2).
#include <iostream>#include <algorithm>#include <fstream>#include <vector>#include <deque>#include <assert.h>#include <bitset>#include <queue>#include <stack>#include <set>#include <map>#include <tuple>#include <stdio.h>#include <string.h>#include <utility>#include <math.h>using namespace std;// This is 4D DP with bottom up approachlong long dp[305][305][305][2], g[305][305];int n, m, D;
Getting WA in some test cases:
#include <stdio.h>int main(){int n, k;scanf("%d %d", &n, &k);int ar[n];while(k--){for (int i = 0; i < n; ++i) {scanf("%d ", &ar[i]) ;}if (n == 1)printf("%d ",ar[0]);for (int i = n - 2; i >= 0; --i) {if (ar[i] < ar[i + 1]){for (int j = n - 1; j >i; --j) {if (ar[j] > ar[i]){int t = ar[i];ar[i] = ar[j];ar[j] = t;// printf("%d %d \n", ar[i], ar[j]);}}
No. The insertion first checks if the element is lesser than or greater than the root at each level. In short, if its in left sub-tree, it must have been smaller than the root. Irrespective of whether it ends up in left or right sub-tree.
This is frustrating, it only shows fatal. I don't know if its an error in the code. Or something else. Here, is the link, will anybody help? IARCS Problem Archive