Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <vector>
- using namespace std;
- int main(){
- int place[100000] = {0};
- int size1, size2, tmp;
- ifstream f;
- f.open("/Users/p/Documents/Saddle/Tasks24/input.txt");
- // f.open("input.txt");
- f >> size1;
- f >> size2;
- for(int i=0; i < size1; i++){
- f >> tmp;
- if (place[tmp]==0) {
- place[tmp] = 1;
- cout << "num saved: " << tmp << "\n";
- }
- }
- for(int i=0; i < size2; i++){
- f >> tmp;
- if (place[tmp]==1) {
- place[tmp] = 2;
- cout << "intersection found: " << tmp << "\n";
- }
- }
- f.close();
- ofstream f2;
- f2.open("/Users/p/Documents/Saddle/Tasks24/output.txt");
- // f2.open("output.txt");
- for (int i=0; i <= 100000; i++){
- if (place[i]==2) f2 << i << " ";
- }
- f2.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement