SHARE
TWEET

Untitled

a guest May 24th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using static System.Console;
  2. using static System.Linq.Enumerable;
  3. using CompetitiveCSharp;
  4.  
  5. namespace CSharpTest
  6. {
  7.     static class Program
  8.     {
  9.         static void WriteTree(SegTree tree)
  10.         {
  11.             for(var i = 0; i < tree.Length; ++i)
  12.             {
  13.                 for(var j = 0; j <= tree.Length; ++j)
  14.                 {
  15.                     Write($"{tree.Get(i, j)} ");
  16.                 }
  17.                 WriteLine();
  18.             }
  19.         }
  20.        
  21.         static void Main(string[] args)
  22.         {
  23.             var test = new int[8];
  24.             foreach(var i in Range(0, 8))
  25.             {
  26.                 test[i] = i + 1;
  27.             }
  28.             var tree = new SegTree(test, (a, b) => a + b);
  29.             WriteTree(tree);
  30.             WriteLine();
  31.  
  32.             tree[1] = 9;
  33.             tree[3] = 10;
  34.             tree[5] = 11;
  35.             tree[7] = 12;
  36.             WriteTree(tree);
  37.         }
  38.     }
  39. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top