vitormartinotti

Untitled

Aug 18th, 2026
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. #define MAXN 100
  3.  
  4. int tipo[1000];
  5.  
  6. int tipo1[1000];
  7. int tipo2[1000];
  8.  
  9. int main(){
  10.     int n; scanf("%d", &n);
  11.    
  12.     for(int i = 1; i <= n; i++){
  13.         int t; scanf("%d", &t);
  14.         tipo[i] = t;
  15.     }
  16.    
  17.     int i1 = 0;
  18.     int i2 = 0;
  19.     for(int i = 1; i <= n; i++){
  20.         int p; scanf("%d", &p);
  21.         if(tipo[i] == 1){
  22.             tipo1[i1] = p;
  23.             i1++;
  24.         }
  25.         else{
  26.             tipo2[i2] = p;
  27.             i2++;
  28.         }
  29.     }
  30.    
  31.     sort(tipo1, tipo1+i1);
  32.     sort(tipo2, tipo2+i2);
  33.    
  34. }
Advertisement
Add Comment
Please, Sign In to add comment