#include <iostream> #include <stdio.h> #include <algorithm> #include <string.h> #include <string> #include <math.h> #include <cmath> #pragma warning(disable:4996) #define mn 1000010 using namespace std; int p[mn], q[mn]; int main() { int i, m, n, r, t;...