Skip to content

Instantly share code, notes, and snippets.

@vmpyr
Created September 20, 2021 07:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vmpyr/83f5b105ab0b37da2cd93bffed1c800c to your computer and use it in GitHub Desktop.
Save vmpyr/83f5b105ab0b37da2cd93bffed1c800c to your computer and use it in GitHub Desktop.
1573-B
#include <bits/stdc++.h>
using namespace std;
int main() {
int t, temp;
cin >> t;
int n[t], ans[t];
int a[t][100000], b[t][100000];
for (int i = 0; i < t; i++) {
cin >> n[i];
for (int j = 0; j<n[i]; j++) {
cin>>a[i][j];
}
for (int j = 0; j<n[i]; j++) {
cin>>b[i][j];
}
}
for (int i=1; i<t;) {
temp = n[i];
for (int j=0; j<n[i];) {
for (int k=0; k<temp;){
if (a[i][j] < b[i][k]) {
ans[i] = j + k;
break;
}
}
temp = ans[i] - j;
if (temp < 0) break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment