Topic Link
http://codeforces.com/contest/798/problem/D
answer
A few days before the race simulation, intelligence actually out of this problem. . Off the hook QAQ
This, then, consider only a sequence of how to do, all the sort of course you can take the biggest, but there is a practice that after every two adjacent pair off to take big ! !
Thus in accordance with (A \) \ sort, to take the first, each two adjacent take back greater b. finished!
Wow how this thought out ah. . . .
Code
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
const int N = 1e5;
int a[N+3],b[N+3],permu[N+3];
vector<int> ans;
int n;
bool cmp(int x,int y) {return a[x]>a[y];}
int main()
{
scanf("%d",&n);
for(int i=1; i<=n; i++) scanf("%d",&a[i]);
for(int i=1; i<=n; i++) scanf("%d",&b[i]);
for(int i=1; i<=n; i++) permu[i] = i;
sort(permu+1,permu+n+1,cmp);
ans.push_back(permu[1]);
for(int i=2; i<=n; i+=2)
{
ans.push_back(b[permu[i]]>b[permu[i+1]] ? permu[i] : permu[i+1]);
}
printf("%d\n",ans.size());
for(int i=0; i<ans.size(); i++) printf("%d ",ans[i]); puts("");
return 0;
}