Submission #1690558
Source Code Expand
using System; using System.Collections.Generic; using System.Linq; using System.IO; using System.Globalization; using System.Diagnostics; using static System.Console; using Pair = System.Collections.Generic.KeyValuePair<int, int>; //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; readonly string alfa = "abcdefghijklmnopqrstuvwxyz"; readonly string ALFA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; int N, T; void solve() { N = cin.nextint; T = cin.nextint; var A = cin.scanlong; int cnt = 0; long max = 0; var l = A[0]; var r = A[0]; for (int i = 1; i <= N; i++) { if (i == N || A[i] < r) { if (max == r - l) { cnt++; } else if (max < r - l) { max = r - l; cnt = 1; } if (i == N) break; l = A[i]; r = A[i]; } else { r = A[i]; } } WriteLine(cnt); } } 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 | D - An Invisible Hand |
User | claw88 |
Language | C# (Mono 4.6.2.0) |
Score | 0 |
Code Size | 2471 Byte |
Status | WA |
Exec Time | 80 ms |
Memory | 20960 KB |
Judge Result
Set Name | sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 400 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
sample | sample_01.txt, sample_02.txt, sample_03.txt |
All | large_01.txt, large_02.txt, random_01.txt, random_02.txt, sample_01.txt, sample_02.txt, sample_03.txt, small_01.txt, small_02.txt, spec_01.txt, spec_02.txt, spec_03.txt, spec_04.txt, spec_05.txt, spec_06.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
large_01.txt | AC | 73 ms | 18912 KB |
large_02.txt | AC | 60 ms | 19168 KB |
random_01.txt | AC | 77 ms | 20960 KB |
random_02.txt | AC | 78 ms | 16864 KB |
sample_01.txt | AC | 24 ms | 9172 KB |
sample_02.txt | AC | 24 ms | 11220 KB |
sample_03.txt | AC | 23 ms | 9172 KB |
small_01.txt | AC | 25 ms | 11220 KB |
small_02.txt | AC | 23 ms | 11220 KB |
spec_01.txt | WA | 74 ms | 18912 KB |
spec_02.txt | WA | 80 ms | 18912 KB |
spec_03.txt | WA | 71 ms | 16864 KB |
spec_04.txt | WA | 72 ms | 18912 KB |
spec_05.txt | WA | 73 ms | 18912 KB |
spec_06.txt | WA | 72 ms | 18912 KB |