看到范围,随便打个 水过去,理论上卡满可能会TLE,但就是过了……
#include <cstdio> #include <ctype.h> const int bufSize = 1e6; inline char nc() { #ifdef DEBUG return getchar(); #endif static char buf[bufSize],*p1 = buf,*p2 = buf; return p1==p2&&(p2=(p1=buf)+fread(buf,1,bufSize,stdin),p1==p2)?EOF:*p1++; } template<typename T> inline T read(T &r) { static char c; r=0; for(c = nc();!isdigit(c);) c = nc(); for(;isdigit(c);c=nc()) r = r * 10 + c - 48; return r; } const int maxn = 1e4 + 100; int n; int a[maxn]; int b[maxn]; int main() { read(n); for(int i = 1;i<=n;++i) read(a[i]); for(int i = 1;i<=n;++i) { for(int j = i + 1;j<=n;++j) if (a[j] > a[i]) { b[i] = j; break; } } for(int i = 1;i<=n;++i) printf("%d ",b[i]); return 0; }