| 记录编号 |
259413 |
评测结果 |
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWW |
| 题目名称 |
2296.[HZOI 2015]元首の非日常 |
最终得分 |
0 |
| 用户昵称 |
AntiLeaf |
是否通过 |
未通过 |
| 代码语言 |
C++ |
运行时间 |
0.000 s |
| 提交时间 |
2016-05-09 15:22:51 |
内存使用 |
0.00 MiB |
显示代码纯文本
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn=1010;
namespace mine{
int __c,__x,__a[110],__i,__j;
bool __neg;
inline int getint(){
__x=__neg=0;
do __c=getchar();while(__c==' '||__c=='\n'||__c=='\r'||__c=='\t');
if(__c=='-'){
__neg=true;
__c=getchar();
}
for(;__c>='0'&&__c<='9';__c=getchar())__x=(__x<<1)+(__x<<3)+(__c^48);
if(__neg)return -__x;
return __x;
}
inline void putint(int __x){
__neg=__x<0;
if(__neg)__x=-__x;
__i=0;
do{
__a[__i++]=__x%10+48;
__x/=10;
}while(__x);
if(__neg)putchar('-');
for(__j=__i-1;__j>=0;__j--)putchar(__a[__j]);
}
}
using namespace mine;
int pre[maxn],next[maxn],n,k;
unsigned long long a[maxn];
bool del(int);
int MAIN();
int haha=MAIN();
int main(){;}
inline int MAIN(){
#define COGS
#ifdef COGS
freopen("bestread.in","r",stdin);
freopen("bestread.out","w",stdout);
#endif
scanf("%d",&n);
for(int i=1;i<=n;i++){
scanf("%llu",&a[i]);
next[i]=i+1;
pre[i]=i-1;
}
next[n]=1;
pre[1]=n;
k=1;
for(int m=1;;k=next[k],m++){
if(m==n){
if(a[pre[k]]>a[k])k=pre[k];
if(del(k))break;
m=0;
}
}
printf("%d",k);
return 0;
}
inline bool del(int x){
if(pre[x]==x||next[x]==x)return true;
pre[next[x]]=pre[x];
next[pre[x]]=next[x];
return false;
}