Submission #1786181
Source Code Expand
using System; using System.Collections.Generic; using System.Linq; using System.IO; using System.Text; using System.Globalization; using System.Diagnostics; using static System.Console; //using System.Numerics; //using static System.Math; class Program { static void Main() { //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false }); new Program().solve(); Out.Flush(); } Scanner cin = new Scanner(); readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑ readonly int mod = 1000000007; void solve() { int N = cin.nextint; var A = cin.scanint; var B = cin.scanint; var C = cin.scanint; Array.Sort(A); Array.Sort(B); Array.Sort(C); var BB = new long[N]; for (int i = 0; i < N; i++) { BB[i] = N - upper_bound(C, B[i]); } for (int i = 1; i < N; i++) { int k = N - i - 1; BB[k] += BB[k + 1]; } long ans = 0; for (int i = 0; i < N; i++) { int b = upper_bound(B, A[i]); if (b == N) break; ans += BB[b]; } WriteLine(ans); } int upper_bound(int[] arr, int val) { int low = 0, high = arr.Length; int mid; while (low < high) { mid = ((high - low) >> 1) + low; if (arr[mid] <= val) low = mid + 1; else high = mid; } return low; } } class Scanner { string[] s; int i; char[] cs = new char[] { ' ' }; public Scanner() { s = new string[0]; i = 0; } public string[] scan { get { return ReadLine().Split(); } } public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } } public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } } public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } } public string next { get { if (i < s.Length) return s[i++]; string st = ReadLine(); while (st == "") st = ReadLine(); s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries); i = 0; return next; } } public int nextint { get { return int.Parse(next); } } public long nextlong { get { return long.Parse(next); } } public double nextdouble { get { return double.Parse(next); } } }
Submission Info
Submission Time | |
---|---|
Task | C - Snuke Festival |
User | claw88 |
Language | C# (Mono 4.6.2.0) |
Score | 300 |
Code Size | 2565 Byte |
Status | AC |
Exec Time | 226 ms |
Memory | 35336 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt, s3.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, s1.txt, s2.txt, s3.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 224 ms | 31284 KB |
02.txt | AC | 224 ms | 29356 KB |
03.txt | AC | 204 ms | 31240 KB |
04.txt | AC | 205 ms | 35336 KB |
05.txt | AC | 168 ms | 29916 KB |
06.txt | AC | 167 ms | 29916 KB |
07.txt | AC | 161 ms | 34136 KB |
08.txt | AC | 160 ms | 32088 KB |
09.txt | AC | 143 ms | 28508 KB |
10.txt | AC | 142 ms | 30556 KB |
11.txt | AC | 135 ms | 28252 KB |
12.txt | AC | 135 ms | 30300 KB |
13.txt | AC | 218 ms | 29420 KB |
14.txt | AC | 218 ms | 33516 KB |
15.txt | AC | 215 ms | 31392 KB |
16.txt | AC | 214 ms | 31392 KB |
17.txt | AC | 218 ms | 31312 KB |
18.txt | AC | 214 ms | 29260 KB |
19.txt | AC | 226 ms | 31408 KB |
20.txt | AC | 134 ms | 32348 KB |
21.txt | AC | 128 ms | 28252 KB |
22.txt | AC | 197 ms | 32228 KB |
23.txt | AC | 212 ms | 29332 KB |
24.txt | AC | 216 ms | 27244 KB |
25.txt | AC | 217 ms | 29360 KB |
26.txt | AC | 21 ms | 11220 KB |
27.txt | AC | 21 ms | 11220 KB |
28.txt | AC | 21 ms | 11220 KB |
29.txt | AC | 21 ms | 11220 KB |
s1.txt | AC | 21 ms | 9172 KB |
s2.txt | AC | 21 ms | 9172 KB |
s3.txt | AC | 22 ms | 13268 KB |