cdqz2017-test11-占卜的准备

cdqz2017-test11-占卜的准备

cdqz2017-test11-占卜的准备

#include<cstdio>
#include<iostream>
#include<algorithm> using namespace std; #define N 201 pair<int,int>p[N];
char s[N]; int ans[N],cnt; bool vis[N]; int start;
int tmp[N]; void read(int &x)
{
x=; char c=getchar();
while(!isdigit(c)) c=getchar();
while(isdigit(c)) { x=x*+c-''; c=getchar(); }
} pair<int,int> operator - (pair<int,int> a,pair<int,int> b) { return make_pair(a.first-b.first,a.second-b.second); } int Cross(pair<int,int> a,pair<int,int> b) { return a.first*b.second-a.second*b.first; } bool cmp(int a,int b)
{
return Cross(p[a]-p[start],p[b]-p[start])>;
} int main()
{
freopen("divination.in","r",stdin);
freopen("divination.out","w",stdout);
int n;
read(n);
for(int i=;i<=n;++i) read(p[i].first),read(p[i].second);
scanf("%s",s+);
start=;
for(int i=;i<=n;++i)
if(p[i]<p[start]) start=i;
ans[++cnt]=start;
vis[start]=true;
int m;
for(int i=;i<=n-;++i)
{
m=;
for(int j=;j<=n;++j)
if(!vis[j]) tmp[++m]=j;
sort(tmp+,tmp+m+,cmp);
if(s[i]=='L') start=tmp[];
else start=tmp[m];
ans[++cnt]=start;
vis[start]=true;
}
for(int i=;i<n;++i) printf("%d ",ans[i]);
for(int i=;i<=n;++i) if(!vis[i]) printf("%d",i);
}
上一篇:Task 6.3 冲刺Two之站立会议2


下一篇:JDBC增强