Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main() {
- int a, b;
- cin >> a;
- int a1[a];
- cin >> b;
- int b1[b];
- for (int i = 0; i < a; ++i) {
- cin >> a1[i];
- }
- for (int i = 0; i < b; ++i) {
- cin >> b1[i];
- }
- for (int i = 0; i < b; i++) {
- int r = 0, l = 0, n = 0;
- for (int j = 0; j < a; ++j) {
- if (b1[i] == a1[j]) {
- if (n == 0) {
- r = j + 1;
- l = j + 1;
- ++n;
- }
- else {
- r = j + 1;
- }
- }
- }
- if ((r + l) > 0) {
- cout << l << " " << r << endl;
- }
- else {
- cout << 0 << endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement