//💭💡🎈fold
#include<set>
#include<map>
#include<cmath>
#include<ctime>
#include<stack>
#include<deque>
#include<queue>
#include<cstdio>
#include<string>
#include<vector>
#include<bitset>
#include<cstring>
#include<cassert>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<algorithm>
#include<unordered_map>
#include<unordered_set>
template<class T>
inline void read(T &x)
{
x=0;
int f=1;
char ch=getchar();
while(ch<'0' || ch>'9')
{
if(ch=='-')f=-1;
ch=getchar();
}
while(ch>='0' && ch<='9')
{
x=x*10+ch-'0';
ch=getchar();
}
x*=f;
}
int a[__],b[__],lisan[__],ys[__];
int n,idx=0;
scanf("%d",&n);
for(int i=1; i<=n; i++)
{
scanf("%d",&a[i]);
lisan[++idx]=a[i];
}
sort(lisan+1,lisan+1+idx);
int len=unique(lisan+1,lisan+idx+1)-lisan-1;
for(int i=1; i<=n; i++)
{
b[i]=lower_bound(lisan+1,lisan+len+1,a[i])-lisan;
ys[b[i]]=a[i];
}
int min_string(char* s,int len)
{
int i=1,j=2,k=0;
while(i<=len && j<=len && k<=len)
{
if(s[i+k]==s[j+k])k++;
else if(s[i+k]<s[j+k])j+=k+1,k=0;
else if(s[i+k]>s[j+k])i+=k+1,k=0;
if(i==j)j++;
}
return min(i,j);
}
网友评论