Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- #define MAXN 100
- int tipo[1000];
- int tipo1[1000];
- int tipo2[1000];
- int main(){
- int n; scanf("%d", &n);
- for(int i = 1; i <= n; i++){
- int t; scanf("%d", &t);
- tipo[i] = t;
- }
- int i1 = 0;
- int i2 = 0;
- for(int i = 1; i <= n; i++){
- int p; scanf("%d", &p);
- if(tipo[i] == 1){
- tipo1[i1] = p;
- i1++;
- }
- else{
- tipo2[i2] = p;
- i2++;
- }
- }
- sort(tipo1, tipo1+i1);
- sort(tipo2, tipo2+i2);
- }
Advertisement
Add Comment
Please, Sign In to add comment