Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <vector>
- #include <algorithm>
- using namespace std;
- int a[1000000];
- int b[1000000];
- vector <int> answer;
- int main(){
- int n;
- ifstream fin("input.txt");
- fin >> n;
- for (int i=0;i<n;i++){
- fin >> a[i];
- }
- for (int i=0;i<n;i++){
- fin >> b[i];
- }
- for (int i=0;i<n;i++){
- for (int j=i+1;j<n;j++){
- if (a[i]==a[j]) continue;
- if (b[i]<=a[j]) break;
- if (b[i]>=b[j]) answer.push_back(j);
- }
- }
- sort( answer.begin(), answer.end() );
- answer.erase( unique( answer.begin(), answer.end() ), answer.end() );
- ofstream fout("output.txt");
- fout << answer.size() << endl;
- for (int i=0;i<answer.size();i++){
- fout << answer[i]+1 << ' ';
- }
- fout.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement