private void SolveOneTestCase() { int n = In.NextInt(), m = In.NextInt(); List <string> dirs = new List <string>(); List <string> need = new List <string>(); for (int i = 0; i < n; ++i) { dirs.Add(In.NextLine()); } for (int i = 0; i < m; ++i) { need.Add(In.NextLine()); } System.Collections.Generic.Dictionary <string, bool> h = new System.Collections.Generic.Dictionary <string, bool>(); for (int i = 0; i < n; ++i) { var data = dirs[i].Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); string path = "/"; foreach (var s in data) { path += s; if (!h.ContainsKey(path)) { h.Add(path, true); } } } int res = 0; for (int i = 0; i < m; i++) { var data = need[i].Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); string path = "/"; foreach (var s in data) { path += s; if (!h.ContainsKey(path)) { h.Add(path, true); ++res; } } } Out.WriteLine(res); }
private void SolveOneTestCase() { var data = In.NextLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); BigInteger[] a = new BigInteger[data.Length - 1]; for (int i = 1; i < data.Length; ++i) { a[i - 1] = StringToInt(data[i]); } BigInteger g = a[0] - a[1]; if (g < 0) { g = -g; } for (int i = 2; i < a.Length; ++i) { g = gcd(g, a[0] - a[i]); } Out.WriteLine((g - (a[0] % g)) % g); }