#46289: thunder will get G4(believe me?)


1121226@stu.wghs.tp.edu.tw (Arthur✨EC)

學校 : 臺北市私立薇閣高級中學
編號 : 252772
來源 : [60.248.154.139]
最後登入時間 :
2025-08-21 12:59:45

#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin>>n;
    int literature[n],math[n];
    for(int i=0; i<n; i++) {
        cin>>literature[i];
    }
    for(int i=0; i<n; i++) {
        cin>>math[i];
    }
    vector<int> literature_list,math_list;
    // 比較成績,分類學生
    for(int i=0;i<n;i++){
        if(literature[i]>math[i]){
            literature_list.push_back(i+1);
        }
        else {
            math_list.push_back(i+1);
        }
    }
    // 對列表排序(雖然目前是順序加入,但為保險,仍做排序)
    sort(literature_list.begin(),literature_list.end());
    sort(math_list.begin(),math_list.end());
    // 輸出語文班
    if (literature_list.empty()){
        cout<<-1<<endl;
    }
    else {
        for(int i=0;i<literature_list.size();i++){
            cout<<literature_list[i];
            if(i!=literature_list.size()-1) cout<<" ";
        }
        cout<<endl;
    }
    // 輸出數理班
    if (math_list.empty()){
        cout<<-1<<endl;
    }
    else{
        for(int i=0;i<math_list.size();i++){
            cout<<math_list[i];
            if(i!=math_list.size()-1) cout<<" ";
        }
        cout<<endl;
    }
    return 0;
}