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;}
^
|