#include <iostream>
#include <string>
#include <map>
using namespace std;
int s[200100] = {0};
void test01()
{
map<int,int> ma , mb ;
int n , i , j ;
string str ;
cin >> n ;
for (i = 1;i <= n;i++)
{
cin >> j ;
ma[j] = i ;
}
cin >> str ;
for (i = 0;i < 2*n;i++)
{
map<int,int>::iterator it = ma.begin();
int x ;
if (str[i] == '0')
{
cout << it->second << " " ;
x = it->second;
mb[it->first] = it->second;
ma.erase(ma.begin());
}
else
{
map<int,int>::iterator iy = mb.end();
iy--;
cout << iy->second << " ";
mb.erase(iy);
}
}
}
int main ()
{
test01();
return 0;
}
洛谷题解 CF982B Bus of Characters
最新推荐文章于 2024-09-13 16:27:15 发布