Facebook
From joao, 1 Year ago, written in C++.
Embed
Download Paste or View Raw
Hits: 110
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main(){
  5.     cin.tie(NULL);
  6.     ios_base::sync_with_stdio(false);
  7.  
  8.    
  9.     vector<pair<float, float>> v;
  10.     vector<pair<float, float>> new_v;
  11.  
  12.     for (int i = 0; i < 300; i++){
  13.         float a;
  14.         cin >> a;
  15.         v.push_back({a, 1});
  16.     }
  17.  
  18.     for (int i = 0; i < 300; i++){
  19.         float a;
  20.         cin >> a;
  21.         v[i].second = a;
  22.     }
  23.  
  24.     for (int i = 1; i < v.size() - 1; i++){
  25.         if (v[i].second <= v[i + 1].second && v[i].second <= v[i - 1].second && v[i].second < 0){
  26.             new_v.push_back(v[i]);
  27.         }
  28.     }
  29.  
  30.     cout << "\n" << "\n";
  31.  
  32.     for (int i = 0; i < new_v.size(); i++){
  33.         cout << new_v[i].first;
  34.         cout << "\n";
  35.     }
  36.  
  37.     cout << "\n" << "\n";
  38.  
  39.     for (int i = 0; i < new_v.size(); i++){
  40.         cout << new_v[i].second;
  41.         cout << "\n";
  42.     }
  43.  
  44.     return 0;
  45.  
  46. }