Skip to content

Instantly share code, notes, and snippets.

View youqad's full-sized avatar
🇬🇧
Research internship at Cambridge University

Younesse Kaddar youqad

🇬🇧
Research internship at Cambridge University
View GitHub Profile
/*************************************************************
*
* MathJax/extensions/TeX/xypic.js
*
* Implements Xy-pic environment.
*
* ---------------------------------------------------------------------
*
* Copyright (c) 2011-2014 Isao Sonobe <[email protected]>.
*
@youqad
youqad / concours-meilleur-dev.py
Created April 4, 2017 16:34
Concours Meilleur Dev : problème final
import sys
from collections import deque
lines = []
for line in sys.stdin:
lines.append(line.rstrip('\n'))
N = int(lines[0])
G = [set() for _ in range(N)]
20
20
3
5
2 3
2 4
2 4
9 3
7 6
5 4 3
20
20
1 1 1 2
1 5 3 2
1 5 1 2
1 5 1 2
1 5 2
1 4 2
1 5 2
1 7 2
20
20
3 3 7
2 4 7
1 5 8
8 6 1
8 3 3
3 3 2 2 3
2 2 3 2 1 4
3 1 3 3 5
20
20
1 4 5 2 3
1 3 3 1 2 3
3 2 2 3 2 1
1 2 2 1 2 2 2
1 2 3 2 2
1 2 3 2 2
4 1 2 1
1 2 1 5
20
20
3 5 3
1 1 1 1
2 1 2 2
1 2 1 1
1 3 1 1 2 1
1 3 2 1
1 4 3 3
1 1 3 3 1 2
20
20
10 5
9 2 4
7 4 4
5 5
4 9
3 9
3 1 8
2 1 8
25
25
3
5
5
2 6
2 6
3 6
4 6
4 2 2
30
30
22 6
10 6 5
3 4 6 4
4 2 5 2
5 1 5 1
5 9
3 4 8
2 2 7