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 |
Re:这道题目是什么意思。。。。谁能帮忙解释一下题意In Reply To:Re:这道题目是什么意思。。。。谁能帮忙解释一下题意 Posted by:gdczcpy at 2010-05-31 19:26:58 > 给你代码你一看就懂什么意思了 > //Ambiguous permutations > > #include <stdio.h> > > int p[100001]; > int inverse[100001]; > int init_pos[100002]; > int n; > > void deal() > { > int i; > for (i = 0; i < n; i++) > { > inverse[i] = init_pos[i + 1]; > if (inverse[i] != p[i]) > { > printf("not ambiguous\n"); > return; > } > } > printf("ambiguous\n"); > } > > void input() > { > scanf("%d", &n); > while (n) > { > int i; > for (i = 0; i < n; i++) > { > scanf("%d", &p[i]); > init_pos[p[i]] = i + 1; > } > deal(); > scanf("%d", &n); > } > } > > int main() > { > input(); > return 0; > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator