Submission #224813
Source Code Expand
using System; using System.Collections.Generic; using System.Linq; class Problem { void Solve() { var sc = new Scanner(); var n = sc.Integer(); sc.Separator = "-".ToCharArray(); var l = new int[n]; var r = new int[n]; for (int i = 0; i < n; i++) { var p = sc.Integer(); var pk = p/10; var pm = p % 10; if (pm < 5) pm = 0; else pm = 5; var q = sc.Integer(); var qk = q / 10; var qm = q % 10; if (qm == 0) { } else if (qm < 5) qm = 5; else { qm = 0; qk++; } l[i] = pk * 10 + pm; r[i] = qk * 10 + qm; } Array.Sort(l, r, 0, n); for (int i = 0; i < n; i++) { var left = l[i]; var right = r[i]; for (int j = i+1; j < n; j++) { if (right < l[j]) { i = j - 1; break; } else right = r[j]; } Console.WriteLine("{0}-{1}",left,right); } } static void Main() { // For CodeForces #if ONLINE_JUDGE System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("en-US"); #endif #if DEBUG var ostream = new System.IO.FileStream("debug.txt", System.IO.FileMode.Open, System.IO.FileAccess.Write); var iStream = new System.IO.FileStream("input.txt", System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.ReadWrite); Console.SetIn(new System.IO.StreamReader(iStream)); System.Diagnostics.Debug.AutoFlush = true; System.Diagnostics.Debug.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(new System.IO.StreamWriter(ostream, System.Text.Encoding.UTF8))); try { #endif var problem = new Problem(); problem.Solve(); #if DEBUG } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(Enumerable.Repeat('/', 50).AsString()); System.Diagnostics.Debug.WriteLine(ex.Message); System.Diagnostics.Debug.WriteLine(ex.StackTrace); Console.Error.WriteLine("{0} occured", ex.GetType()); } Console.ReadKey(true); #endif } } public class Scanner { readonly System.IO.TextReader reader; string[] buffer = new string[0]; int position; public char[] Separator { get; set; } public Scanner(System.IO.TextReader reader = null, string separator = null) { if (reader == null) this.reader = Console.In; else this.reader = reader; if (string.IsNullOrEmpty(separator)) separator = " "; this.Separator = separator.ToCharArray(); } public string Scan() { if (this.position < this.buffer.Length) return this.buffer[this.position++]; this.buffer = this.reader.ReadLine().Split(this.Separator, StringSplitOptions.RemoveEmptyEntries); this.position = 0; return this.buffer[this.position++]; } public string[] ScanToEndLine() { if (this.position >= this.buffer.Length) return this.reader.ReadLine().Split(this.Separator, StringSplitOptions.RemoveEmptyEntries); var size = this.buffer.Length - this.position; var ar = new string[size]; Array.Copy(this.buffer, position, ar, 0, size); return ar; } public string ScanLine() { if (this.position >= this.buffer.Length) return this.reader.ReadLine(); else { var sb = new System.Text.StringBuilder(); for (; this.position < buffer.Length; this.position++) { sb.Append(this.buffer[this.position]); sb.Append(' '); } return sb.ToString(); } } public string[] ScanArray(int length) { var ar = new string[length]; for (int i = 0; i < length; i++) { ar[i] = this.Scan(); } return ar; } public int Integer() { return int.Parse(this.Scan()); } public long Long() { return long.Parse(this.Scan()); } public double Double() { return double.Parse(this.Scan()); } public int[] IntArray(int length) { var a = new int[length]; for (int i = 0; i < length; i++) a[i] = this.Integer(); return a; } public long[] LongArray(int length) { var a = new long[length]; for (int i = 0; i < length; i++) a[i] = this.Long(); return a; } public double[] DoubleArray(int length) { var a = new double[length]; for (int i = 0; i < length; i++) a[i] = this.Double(); return a; } } static public partial class EnumerableEx { static public string AsString(this IEnumerable<char> source) { return new string(source.ToArray()); } static public IEnumerable<T> Enumerate<T>(this int count, Func<int, T> selector) { return Enumerable.Range(0, count).Select(x => selector(x)); } } //*/
Submission Info
Submission Time | |
---|---|
Task | D - 感雨時刻の整理 |
User | camypaper |
Language | C# (Mono 2.10.8.1) |
Score | 0 |
Code Size | 5602 Byte |
Status | WA |
Exec Time | 1442 ms |
Memory | 6584 KB |
Judge Result
Set Name | all | ||||
---|---|---|---|---|---|
Score / Max Score | 0 / 100 | ||||
Status |
|
Set Name | Test Cases |
---|---|
all | 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, cho_cho_chokudai.txt, chokudai_ga_cho.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt, test_36.txt, test_37.txt, test_38.txt, test_39.txt, test_40.txt, test_41.txt, test_42.txt, test_43.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_01.txt | AC | 113 ms | 5620 KB |
00_sample_02.txt | WA | 115 ms | 5632 KB |
00_sample_03.txt | WA | 115 ms | 5664 KB |
cho_cho_chokudai.txt | WA | 1415 ms | 6460 KB |
chokudai_ga_cho.txt | WA | 1422 ms | 6528 KB |
test_01.txt | WA | 160 ms | 5724 KB |
test_02.txt | WA | 114 ms | 5748 KB |
test_03.txt | WA | 116 ms | 5748 KB |
test_04.txt | WA | 115 ms | 5748 KB |
test_05.txt | WA | 118 ms | 5740 KB |
test_06.txt | WA | 118 ms | 5748 KB |
test_07.txt | WA | 116 ms | 5744 KB |
test_08.txt | WA | 117 ms | 5752 KB |
test_09.txt | WA | 125 ms | 5884 KB |
test_10.txt | WA | 123 ms | 5900 KB |
test_11.txt | WA | 115 ms | 5740 KB |
test_12.txt | WA | 119 ms | 5808 KB |
test_13.txt | WA | 117 ms | 5760 KB |
test_14.txt | WA | 122 ms | 5888 KB |
test_15.txt | WA | 123 ms | 5892 KB |
test_16.txt | WA | 115 ms | 5736 KB |
test_17.txt | WA | 118 ms | 5756 KB |
test_18.txt | WA | 115 ms | 5632 KB |
test_19.txt | WA | 121 ms | 5748 KB |
test_20.txt | WA | 118 ms | 5768 KB |
test_21.txt | WA | 1416 ms | 6584 KB |
test_22.txt | WA | 1426 ms | 6516 KB |
test_23.txt | WA | 1442 ms | 6536 KB |
test_24.txt | WA | 1434 ms | 6540 KB |
test_25.txt | WA | 1408 ms | 6528 KB |
test_26.txt | WA | 169 ms | 6312 KB |
test_27.txt | WA | 1421 ms | 6404 KB |
test_28.txt | WA | 166 ms | 6268 KB |
test_29.txt | WA | 114 ms | 5672 KB |
test_30.txt | WA | 115 ms | 5664 KB |
test_31.txt | WA | 126 ms | 5960 KB |
test_32.txt | WA | 114 ms | 5740 KB |
test_33.txt | WA | 152 ms | 6016 KB |
test_34.txt | WA | 119 ms | 5616 KB |
test_35.txt | WA | 118 ms | 5628 KB |
test_36.txt | WA | 1423 ms | 6536 KB |
test_37.txt | WA | 173 ms | 6272 KB |
test_38.txt | WA | 165 ms | 6148 KB |
test_39.txt | WA | 207 ms | 6308 KB |
test_40.txt | WA | 194 ms | 6260 KB |
test_41.txt | WA | 1428 ms | 6496 KB |
test_42.txt | WA | 1415 ms | 6408 KB |
test_43.txt | WA | 1409 ms | 6452 KB |