提出 #891342
ソースコード 拡げる
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Segtree<T>
{
int n;
T[] tree;
Func<T, T, T> f;
T exnum;
public Segtree(int m, Func<T, T, T> f, T ex)
{
this.f = f;
this.exnum = ex;
n = 1;
while (n < m) n <<= 1;
tree = new T[(n << 1) - 1];
for (int i = 0; i < tree.Length; i++) tree[i] = ex;
}
public Segtree(int m, T ini, Func<T, T, T> f, T ex)
{
this.f = f;
this.exnum = ex;
n = 1;
while (n < m) n <<= 1;
tree = new T[(n << 1) - 1];
for (int i = 0; i < tree.Length; i++) tree[i] = ini;
for (int i = 0; i < m; ++i) update(i, ini);
}
public void update(int j, T x)
{
int i = j + n - 1;
tree[i] = x;
while (i > 0)
{
i = (i - 1) >> 1;
tree[i] = f(tree[(i << 1) + 1], tree[(i << 1) + 2]);
}
}
public T look(int i) { return tree[i + n - 1]; }
// [s, t]
public T run(int s, int t) { return query(s, t + 1, 0, 0, n); }
T query(int s, int t, int k, int l, int r)
{
if (r <= s || t <= l) return exnum;
if (s <= l && r <= t) return tree[k];
return f(query(s, t, (k << 1) + 1, l, (l + r) >> 1), query(s, t, (k + 1) << 1, (l + r) >> 1, r));
}
}
namespace Codeforces
{
class Program
{
static void Main(string[] args)
{
string input = Console.ReadLine();
for (int i = 0; i < input.Length; i++)
{
Console.Write(input[i]);
if (i == 3) Console.Write(" ");
}
Console.WriteLine();
}
}
}
提出情報
ジャッジ結果
| セット名 |
Sample |
All |
| 得点 / 配点 |
0 / 0 |
100 / 100 |
| 結果 |
|
|
| セット名 |
テストケース |
| Sample |
0_00.txt, 0_01.txt, 0_02.txt |
| All |
0_00.txt, 0_01.txt, 0_02.txt, 1_00.txt, 1_01.txt, 1_02.txt |
| ケース名 |
結果 |
実行時間 |
メモリ |
| 0_00.txt |
AC |
20 ms |
2648 KiB |
| 0_01.txt |
AC |
19 ms |
2648 KiB |
| 0_02.txt |
AC |
19 ms |
2648 KiB |
| 1_00.txt |
AC |
20 ms |
2648 KiB |
| 1_01.txt |
AC |
19 ms |
2648 KiB |
| 1_02.txt |
AC |
19 ms |
2648 KiB |