Good morning. I would like some help to create a code that is accepted by SPOJ.
The proposed problem is as follows: "You get an ordered sequence of n integers S = s1, s2, ..., sn, and an ordered sequence of integers m Q = q1, q2, ..., qm. belong to Q. "
I'm trying to do it in C ++ and using vectors. But I'm bumping into an infinite loop that I'm not sure how to handle.
And I still have not thought about how to compare the vectors and display the ones that are present only in the S sequence.
Follow the code I've made so far:
#include <iostream>
using namespace std;
int main () {
int S, Q;
cin >> S;
int * S_vetor = new int[S];
for (int i = 0; i < S; i++) {
cin >> S_vetor[i];
}
cin >> Q;
int * Q_vetor = new int[Q];
for (int i = 0; i <= Q; i++) {
cin >> Q_vetor[i];
}
return 0;
}
From now on, I'm grateful for the attention.