Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using static System.Console;
- using static System.Linq.Enumerable;
- using CompetitiveCSharp;
- namespace CSharpTest
- {
- static class Program
- {
- static void WriteTree(SegTree tree)
- {
- for(var i = 0; i < tree.Length; ++i)
- {
- for(var j = 0; j <= tree.Length; ++j)
- {
- Write($"{tree.Get(i, j)} ");
- }
- WriteLine();
- }
- }
- static void Main(string[] args)
- {
- var test = new int[8];
- foreach(var i in Range(0, 8))
- {
- test[i] = i + 1;
- }
- var tree = new SegTree(test, (a, b) => a + b);
- WriteTree(tree);
- WriteLine();
- tree[1] = 9;
- tree[3] = 10;
- tree[5] = 11;
- tree[7] = 12;
- WriteTree(tree);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement