| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
O(N^2)直接水啊,代码不到600B。核心代码:
void work()
{
for (int i = n; i >= 1; i--){
ans[i] = num[i] + f[num[i]];
for (int j = num[i]; j < i; j++)
f[j] = f[j + 1] + 1;
}
}
不过稍微有点慢,100+ms水过。
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator