Contest Duration: ~ (local time) (150 minutes) Back to Home

Submission #5821378

Source Code Expand

Copy
```using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using Debug;
//using static System.Globalization.CultureInfo;
//using Edge = Pair<long, int>;
using System.Text;
class Program
{
static void Main(string[] args)
{
Solve();
//WriteLine(Solve());
}
static void Solve()
{
var res = 0L;
var ct = new int[Input.Alfa.Length];
for (var i = 0; i < str.Length; i++)
ct[str[i] - 'a']++;
foreach (var v in ct)
res += v * (v - 1L) / 2;
WriteLine(str.Length * (str.Length - 1L) / 2 - res + 1);
}
}

public class Input
{
public static int[] ar => read.Split(' ').Select(int.Parse).ToArray();
public  static int num => ToInt32(read);
public static long[] arL => read.Split(' ').Select(long.Parse).ToArray();
public  static long numL => ToInt64(read);
public static char[][] gred(int h)
public static int[] ar1D(int n)
=> Enumerable.Repeat(0, n).Select(_ => num).ToArray();
public static long[] arL1D(int n)
=> Enumerable.Repeat(0, n).Select(_ => numL).ToArray();
public static string[] strs(int n)
public static int[][] ar2D(int n)
=> Enumerable.Repeat(0, n).Select(_ => ar).ToArray();
public static long[][] arL2D(int n)
=> Enumerable.Repeat(0, n).Select(_ => arL).ToArray();
public static T getValue<T>(string g)
{
var t = typeof(T);
if (t == typeof(int))
return (T)(object)int.Parse(g);
if (t == typeof(long))
return (T)(object)long.Parse(g);
if (t == typeof(string))
return (T)(object)g;
if (t == typeof(char))
return (T)(object)char.Parse(g);
if (t == typeof(double))
return (T)(object)double.Parse(g);
if (t == typeof(bool))
return (T)(object)bool.Parse(g);
return default(T);
}
public const long Inf = (long)1e18;
public const double eps = 1e-6;
public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
public  const int MOD = 1000000007;
}```

#### Submission Info

Submission Time 2019-06-08 15:15:12+0900 B - Reverse and Compare hibatibati C# (Mono 4.6.2.0) 500 2484 Byte AC 22 ms 13140 KB

#### Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
sample_01.txt 20 ms 9044 KB
sample_02.txt 19 ms 9044 KB
sample_03.txt 20 ms 11092 KB