F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

View Compilation Error

0_0_20614689_2631.cpp:5:26: error: stray '#' in program
     using namespace std; #define maxn 100007int a[maxn],b[maxn],vis[maxn];int dfs(int x){    vis[x] = 1;    if(vis[b[a[x]]]) return 1;    return dfs(b[a[x]])+1;}int main(){    int t,n,u;    scanf("%d",&t);    while(t--){        scanf("%d",&n);        for(int i = 1;i <= n; i++){            scanf("%d",&u);            a[u] = i;        }        for(int i = 1;i <= n; i++)            scanf("%d",&b[i]);        memset(vis,0,sizeof(vis));        int ans = n;        for(int i = 1;i <= n; i++){            if(vis[i] == 0) {                if(dfs(i) > 1) ans--;            }        }        printf("%d\n",ans);    }    return 0;}
                          ^
0_0_20614689_2631.cpp:5:27: error: 'define' does not name a type
     using namespace std; #define maxn 100007int a[maxn],b[maxn],vis[maxn];int dfs(int x){    vis[x] = 1;    if(vis[b[a[x]]]) return 1;    return dfs(b[a[x]])+1;}int main(){    int t,n,u;    scanf("%d",&t);    while(t--){        scanf("%d",&n);        for(int i = 1;i <= n; i++){            scanf("%d",&u);            a[u] = i;        }        for(int i = 1;i <= n; i++)            scanf("%d",&b[i]);        memset(vis,0,sizeof(vis));        int ans = n;        for(int i = 1;i <= n; i++){            if(vis[i] == 0) {                if(dfs(i) > 1) ans--;            }        }        printf("%d\n",ans);    }    return 0;}
                           ^
0_0_20614689_2631.cpp: In function 'int dfs(int)':
0_0_20614689_2631.cpp:5:94: error: 'vis' was not declared in this scope
     using namespace std; #define maxn 100007int a[maxn],b[maxn],vis[maxn];int dfs(int x){    vis[x] = 1;    if(vis[b[a[x]]]) return 1;    return dfs(b[a[x]])+1;}int main(){    int t,n,u;    scanf("%d",&t);    while(t--){        scanf("%d",&n);        for(int i = 1;i <= n; i++){            scanf("%d",&u);            a[u] = i;        }        for(int i = 1;i <= n; i++)            scanf("%d",&b[i]);        memset(vis,0,sizeof(vis));        int ans = n;        for(int i = 1;i <= n; i++){            if(vis[i] == 0) {                if(dfs(i) > 1) ans--;            }        }        printf("%d\n",ans);    }    return 0;}
                                                                                              ^
0_0_20614689_2631.cpp:5:116: error: 'b' was not declared in this scope
     using namespace std; #define maxn 100007int a[maxn],b[maxn],vis[maxn];int dfs(int x){    vis[x] = 1;    if(vis[b[a[x]]]) return 1;    return dfs(b[a[x]])+1;}int main(){    int t,n,u;    scanf("%d",&t);    while(t--){        scanf("%d",&n);        for(int i = 1;i <= n; i++){            scanf("%d",&u);            a[u] = i;        }        for(int i = 1;i <= n; i++)            scanf("%d",&b[i]);        memset(vis,0,sizeof(vis));        int ans = n;        for(int i = 1;i <= n; i++){            if(vis[i] == 0) {                if(dfs(i) > 1) ans--;            }        }        printf("%d\n",ans);    }    return 0;}
                                                                                                                    ^
0_0_20614689_2631.cpp:5:118: error: 'a' was not declared in this scope
     using namespace std; #define maxn 100007int a[maxn],b[maxn],vis[maxn];int dfs(int x){    vis[x] = 1;    if(vis[b[a[x]]]) return 1;    return dfs(b[a[x]])+1;}int main(){    int t,n,u;    scanf("%d",&t);    while(t--){        scanf("%d",&n);        for(int i = 1;i <= n; i++){            scanf("%d",&u);            a[u] = i;        }        for(int i = 1;i <= n; i++)            scanf("%d",&b[i]);        memset(vis,0,sizeof(vis));        int ans = n;        for(int i = 1;i <= n; i++){            if(vis[i] == 0) {                if(dfs(i) > 1) ans--;            }        }        printf("%d\n",ans);    }    return 0;}
                                                                                                                      ^
0_0_20614689_2631.cpp:5:150: error: 'b' was not declared in this scope
     using namespace std; #define maxn 100007int a[maxn],b[maxn],vis[maxn];int dfs(int x){    vis[x] = 1;    if(vis[b[a[x]]]) return 1;    return dfs(b[a[x]])+1;}int main(){    int t,n,u;    scanf("%d",&t);    while(t--){        scanf("%d",&n);        for(int i = 1;i <= n; i++){            scanf("%d",&u);            a[u] = i;        }        for(int i = 1;i <= n; i++)            scanf("%d",&b[i]);        memset(vis,0,sizeof(vis));        int ans = n;        for(int i = 1;i <= n; i++){            if(vis[i] == 0) {                if(dfs(i) > 1) ans--;            }        }        printf("%d\n",ans);    }    return 0;}
                                                                                                                                                      ^
0_0_20614689_2631.cpp:5:152: error: 'a' was not declared in this scope
     using namespace std; #define maxn 100007int a[maxn],b[maxn],vis[maxn];int dfs(int x){    vis[x] = 1;    if(vis[b[a[x]]]) return 1;    return dfs(b[a[x]])+1;}int main(){    int t,n,u;    scanf("%d",&t);    while(t--){        scanf("%d",&n);        for(int i = 1;i <= n; i++){            scanf("%d",&u);            a[u] = i;        }        for(int i = 1;i <= n; i++)            scanf("%d",&b[i]);        memset(vis,0,sizeof(vis));        int ans = n;        for(int i = 1;i <= n; i++){            if(vis[i] == 0) {                if(dfs(i) > 1) ans--;            }        }        printf("%d\n",ans);    }    return 0;}
                                                                                                                                                        ^
0_0_20614689_2631.cpp: In function 'int main()':
0_0_20614689_2631.cpp:5:318: error: 'a' was not declared in this scope
     using namespace std; #define maxn 100007int a[maxn],b[maxn],vis[maxn];int dfs(int x){    vis[x] = 1;    if(vis[b[a[x]]]) return 1;    return dfs(b[a[x]])+1;}int main(){    int t,n,u;    scanf("%d",&t);    while(t--){        scanf("%d",&n);        for(int i = 1;i <= n; i++){            scanf("%d",&u);            a[u] = i;        }        for(int i = 1;i <= n; i++)            scanf("%d",&b[i]);        memset(vis,0,sizeof(vis));        int ans = n;        for(int i = 1;i <= n; i++){            if(vis[i] == 0) {                if(dfs(i) > 1) ans--;            }        }        printf("%d\n",ans);    }    return 0;}
                                                                                                                                                                                                                                                                                                                              ^
0_0_20614689_2631.cpp:5:394: error: 'b' was not declared in this scope
     using namespace std; #define maxn 100007int a[maxn],b[maxn],vis[maxn];int dfs(int x){    vis[x] = 1;    if(vis[b[a[x]]]) return 1;    return dfs(b[a[x]])+1;}int main(){    int t,n,u;    scanf("%d",&t);    while(t--){        scanf("%d",&n);        for(int i = 1;i <= n; i++){            scanf("%d",&u);            a[u] = i;        }        for(int i = 1;i <= n; i++)            scanf("%d",&b[i]);        memset(vis,0,sizeof(vis));        int ans = n;        for(int i = 1;i <= n; i++){            if(vis[i] == 0) {                if(dfs(i) > 1) ans--;            }        }        printf("%d\n",ans);    }    return 0;}
                                                                                                                                                                                                                                                                                                                                                                                                          ^
0_0_20614689_2631.cpp:5:415: error: 'vis' was not declared in this scope
     using namespace std; #define maxn 100007int a[maxn],b[maxn],vis[maxn];int dfs(int x){    vis[x] = 1;    if(vis[b[a[x]]]) return 1;    return dfs(b[a[x]])+1;}int main(){    int t,n,u;    scanf("%d",&t);    while(t--){        scanf("%d",&n);        for(int i = 1;i <= n; i++){            scanf("%d",&u);            a[u] = i;        }        for(int i = 1;i <= n; i++)            scanf("%d",&b[i]);        memset(vis,0,sizeof(vis));        int ans = n;        for(int i = 1;i <= n; i++){            if(vis[i] == 0) {                if(dfs(i) > 1) ans--;            }        }        printf("%d\n",ans);    }    return 0;}
                                                                                                                                                                                                                                                                                                                                                                                                                               ^


Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-12-05 03:36:24, Gzip enabled