|
|
вернуться в форумTLE #18 static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); int[] values = new int[n]; for (int i = 0; i < n + 1; i++) { string[] str = Console.ReadLine().Split(); int a = int.Parse(str[0]) - 1; int b = int.Parse(str[1]) - 1; int c = int.Parse(str[2]); for (int j = a; j <= b; j++) { values[j] += c; } } Console.Write(string.Join(" ", values)); } It's simple algorithm. How to speed it up? Which algorithm should I use? Edited by author 21.01.2026 21:22 |
|
|