https://www.acmicpc.net/problem/11728


이정돈 풀것지 하면서, 도전한 문제인데...

아무리 해도해도 시간초과나서 자존심 -32% 떡락하는 중입니다.


뭐가 문제인걸까요...





using System; using System.IO; using System.Text; namespace 콘솔테스트 { class Program { static void Main(string[] args) { StreamReader sr = new StreamReader(Console.OpenStandardInput()); StringBuilder sb = new StringBuilder(); string[] index = sr.ReadLine().Split(' '); int n = int.Parse(index[0]); int m = int.Parse(index[1]); int[] a = Array.ConvertAll(sr.ReadLine().Split(' '), s => int.Parse(s)); int[] b = Array.ConvertAll(sr.ReadLine().Split(' '), s => int.Parse(s)); int a_index = 0; int b_index = 0; while (a_index < n && b_index < m) { if (a[a_index] < b[b_index]) { sb.Append(a[a_index++] + " "); } else { sb.Append(b[b_index++] + " "); } } while (a_index < n) { sb.Append(a[a_index++] + " "); } while (b_index < m) { sb.Append(b[b_index++] + " "); } Console.Write(sb.ToString()); sr.Close(); Console.ReadLine(); } } }



뭐가 문제인걸까요..?