Codeforces Round #383 (Div. 2), problem: (D) Arpa’s weak amphitheater and Mehrdad’s valuable Hoses Solution in C/C++

By |2017-04-07T22:11:48+00:00December 17th, 2016|Categories: C/C++, Programming|Tags: , , , , , , , |

#include<stdio.h> int n, m, maxW, p[2000], w[2000], b[2000], prev[2000], next[2000], gb[2000],gw[2000]; int root(int i) { if(p[i]!=i) p[i] = root(p[i]); return p[i]; } int main() { scanf("%i%i%i",&n,&m,&maxW); for(int i=0;i<n;i++) scanf("%i",w+i); for(int i=0;i<n;i++) scanf("%i",b+i); int x, y; for(int i=0;i<n;i++) p[i]=i; for(int i=0;i<m;i++) { scanf("%i%i",&x,&y); x--; y--; [...]