Codeforces Round #393 (Div. 2) (8VC Venture Cup 2017 – Final Round Div. 2 Edition), problem: (C) Pavel and barbecue Solution in C/C++

By |2017-04-07T22:10:18+06:00January 23rd, 2017|Categories: C/C++, Programming|Tags: , , , , , , , , |

#include <stdio.h> #define N 200000 int pp[N], used[N]; void dfs(int i) { if (used[i]) return; used[i] = 1; dfs(pp[i]); } int main() { int n, i, sum, cnt; static int bb[N]; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d", &pp[i]); [...]