[問題] HappyStorm's Sock Sucks
看板Prob_Solve (計算數學 Problem Solving)作者williamd4112 (Williamd)時間9年前 (2015/01/28 21:44)推噓4(4推 0噓 44→)留言48則, 7人參與討論串1/1
身邊找不到人討論題目...幸好還有這裡
原題目:(nthu_oj)
※先聲明這不是作業,只是自己的練習
http://acm.cs.nthu.edu.tw/problem.php?pid=7667
這題我的作法是把襪子宣告成一個struct來儲存name,size
struct Sock{
string name,size;
}
然後定義operator <(less than operator)
再把struct(襪子)跟int(次數)存到map裏
用讀進來的name, size建立struct, 插入到map中
如果已經在map中,則次數遞增
如果不在,則初始化為1
測試結果是正確的, 但超時...
想請問有什麼方法可以做更快?
(不知道他題目中給的hint: O(nlogn)會超時的用意為何...
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.114.196.141
※ 文章網址: https://www.ptt.cc/bbs/Prob_Solve/M.1422452649.A.834.html
推
01/28 21:51, , 1F
01/28 21:51, 1F
→
01/28 21:52, , 2F
01/28 21:52, 2F
→
01/28 21:52, , 3F
01/28 21:52, 3F
→
01/28 21:52, , 4F
01/28 21:52, 4F
→
01/28 21:53, , 5F
01/28 21:53, 5F
→
01/28 22:02, , 6F
01/28 22:02, 6F
→
01/28 22:02, , 7F
01/28 22:02, 7F
→
01/28 22:06, , 8F
01/28 22:06, 8F
→
01/28 22:34, , 9F
01/28 22:34, 9F
→
01/28 22:34, , 10F
01/28 22:34, 10F
→
01/28 22:35, , 11F
01/28 22:35, 11F
→
01/28 22:39, , 12F
01/28 22:39, 12F
→
01/28 23:05, , 13F
01/28 23:05, 13F
推
01/28 23:13, , 14F
01/28 23:13, 14F
→
01/28 23:14, , 15F
01/28 23:14, 15F
→
01/29 00:34, , 16F
01/29 00:34, 16F
推
01/29 00:41, , 17F
01/29 00:41, 17F
→
01/29 01:18, , 18F
01/29 01:18, 18F
→
01/29 01:19, , 19F
01/29 01:19, 19F
→
01/29 01:20, , 20F
01/29 01:20, 20F
→
01/29 02:22, , 21F
01/29 02:22, 21F
→
01/29 02:23, , 22F
01/29 02:23, 22F
→
01/29 02:23, , 23F
01/29 02:23, 23F
→
01/29 15:38, , 24F
01/29 15:38, 24F
→
01/29 15:39, , 25F
01/29 15:39, 25F
→
01/29 15:39, , 26F
01/29 15:39, 26F
→
01/29 15:39, , 27F
01/29 15:39, 27F
→
01/29 15:39, , 28F
01/29 15:39, 28F
→
01/29 15:40, , 29F
01/29 15:40, 29F
→
01/29 15:40, , 30F
01/29 15:40, 30F
→
01/29 15:40, , 31F
01/29 15:40, 31F
→
01/29 15:40, , 32F
01/29 15:40, 32F
→
01/29 15:41, , 33F
01/29 15:41, 33F
→
01/29 15:41, , 34F
01/29 15:41, 34F
→
01/29 15:48, , 35F
01/29 15:48, 35F
→
01/29 15:49, , 36F
01/29 15:49, 36F
→
01/29 15:49, , 37F
01/29 15:49, 37F
→
01/29 15:51, , 38F
01/29 15:51, 38F
→
01/29 16:42, , 39F
01/29 16:42, 39F
→
01/29 16:44, , 40F
01/29 16:44, 40F
→
01/29 16:45, , 41F
01/29 16:45, 41F
→
01/29 16:45, , 42F
01/29 16:45, 42F
→
01/29 16:47, , 43F
01/29 16:47, 43F
→
01/29 16:48, , 44F
01/29 16:48, 44F
→
01/29 16:48, , 45F
01/29 16:48, 45F
推
01/29 20:01, , 46F
01/29 20:01, 46F
→
01/30 01:21, , 47F
01/30 01:21, 47F
→
01/30 01:22, , 48F
01/30 01:22, 48F
Prob_Solve 近期熱門文章
PTT數位生活區 即時熱門文章