Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Programming Contest Hacks

3,592 views

Published on

プログラミングコンテストについての紹介と基本的なアルゴリズムについての解説です.

以下のリソースからかなりの部分を引用させていただいております. 大変感謝いたします.
* プログラミングコンテストチャレンジブック
http://www.amazon.co.jp/%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0%E3%82%B3%E3%83%B3%E3%83%86%E3%82%B9%E3%83%88%E3%83%81%E3%83%A3%E3%83%AC%E3%83%B3%E3%82%B8%E3%83%96%E3%83%83%E3%82%AF-%E7%A7%8B%E8%91%89-%E6%8B%93%E5%93%89/dp/4839931992
*

Published in: Technology
  • D0WNL0AD FULL ▶ ▶ ▶ ▶ http://1lite.top/GvJWQ ◀ ◀ ◀ ◀
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Programming Contest Hacks

  1. 1. Hacks @cou929
  2. 2. Agenda • • • • • • • • • •
  3. 3. @cou929 • ( ) • web • Web technologies • HTML + CSS + JavaScript
  4. 4. • • • a.k.a. • • • etc.
  5. 5. . n . , 4 . m . . , , . k_1, k_2, ..., k_n , m , ”Yes”, ”No” . 1 <= n <= 50 1 <= m <= 10^8 1 <= k_i <= 10^8 • 1-1
  6. 6. • n = 3, m = 10, k = {1, 2, 3, 5} • “Yes” ({1, 1, 3, 5} ) • n = 3, m = 9, k = {1, 3, 5} • “No”
  7. 7. • • • •
  8. 8. • • •4 • n 50 • 1 <= n <= 1000 ?
  9. 9. TopCoder • ( 2, 3 ) • ! • 1 2 3 • (C++, Java, C#, VB) • • TopCoder • • NASA • http://www.topcoder.com/tc
  10. 10. Google Code Jam • • 2 3 • 2 • • Google • ? • http://code.google.com/codejam
  11. 11. ACM ICPC • • • • • >< • http://cm.baylor.edu/welcome.icpc
  12. 12. • CodeForces • http://codeforces.ru/ • CodeChef • http://www.codechef.com/ • ICFP Programing Contest • http://icfpcontest.org/ • etc.
  13. 13. • , • ICPC • • • •
  14. 14. • PKU Judge Online • http://acm.pku.edu.cn/JudgeOnline/ • Sphere online judge • http://www.spoj.pl/ • AIZU Online Judge • http://rose.u-aizu.ac.jp/onlinejudge/
  15. 15. • • • • • •
  16. 16. • • , , • • • • •
  17. 17. • • •
  18. 18. • “ ” • • , •
  19. 19. • • •
  20. 20. • -> -> ! -> • -> -> ! • •
  21. 21. • -> -> -> -> -> -> • •
  22. 22. • • O- • •
  23. 23. O- • • O(log n), O(n^3) • • • • 3 -> O(n^3) ! • • .
  24. 24. • ,n 50 • O(n^4) • 6,250,000
  25. 25. • 2 1,000,000 100,000,000 1,000,000,000
  26. 26. • • • (dfs) • (bfs) • • •
  27. 27. : • O(n^4) • n=3 n1 n2 n3 n1 n2 n3 n1 n2 n3 n1 n2 n3 n1 n2 n3 n1 n2 n3 …… ……
  28. 28. • http://www.itmedia.co.jp/enterprise/articles/1001/16/news001.html
  29. 29. • , • •
  30. 30. : a1, a2, ..., an . , k . 1 <= n <= 20 - 10^8 <= a_i <= 10^8 - 10^8 <= k <= 10^8 n=4 a = {1, 2, 4, 7} k = 13 "Yes" (2 + 4 + 7) • 2-1
  31. 31. • a_i , / • a_i • O(2^n) •n 20 • 2 ^ 20 = 1,048,576
  32. 32. • “ : - ” (http:// www.itmedia.co.jp/enterprise/articles/1001/16/news001.html)
  33. 33. • • dfs • • dfs bfs • • O( * )
  34. 34. : • : • http://okajima.air- nifty.com/b/2010/01/ post-abc6.html
  35. 35. : , N, M . N = M = 50 • http://okajima.air-nifty.com/b/2010/01/post-abc6.html
  36. 36. : ************************** *S* * * * * * * ************* * * * * ************ * * * * ************** *********** * * ** *********************** * * G * * * *********** * * * * ******* * * * * * ************************** • http://okajima.air-nifty.com/b/2010/01/post-abc6.html
  37. 37. : ************************** *S* * $$$ * *$* *$$*$ ************* * *$* $$* $$$************ * *$$$$* $$$$$ * **************$*********** * $$$$$$$$$$$$$ * **$*********************** * $$$$$*$$$$$$$$$$$$$$G * * * $$$ *********** * * * * ******* * * * * * ************************** • http://okajima.air-nifty.com/b/2010/01/post-abc6.html
  38. 38. • N*M • 4 • O(N * M * 4) • 50 * 50 * 4 = 10,000
  39. 39. • , • : • m • dfs bfs •
  40. 40. • Binary Search • • O(log(n))
  41. 41. • http://www.gutterbucket.com/general-code/binary-search.html
  42. 42. • Dynamic Programming, DP • , •
  43. 43. : w v N , W . , W , . • “ALGORITHM NOTE ” (http://algorithms.blog55.fc2.com/ blog-entry-85.html)
  44. 44. •N / 2 • O(2^N) •N 100 , 2^100 = 10^30
  45. 45. DP • (N+1) * (W+1) C • C[i][w] w 0 i
  46. 46. • C[i][w] 2 • C[i - 1][w - i ]+ i • C[i - 1][w]
  47. 47. • “ALGORITHM NOTE ” (http://algorithms.blog55.fc2.com/ blog-entry-85.html)
  48. 48. • “ALGORITHM NOTE ” (http://algorithms.blog55.fc2.com/ blog-entry-85.html)
  49. 49. • “ALGORITHM NOTE ” (http://algorithms.blog55.fc2.com/ blog-entry-85.html)
  50. 50. • “ALGORITHM NOTE ” (http://algorithms.blog55.fc2.com/ blog-entry-85.html)
  51. 51. • “ALGORITHM NOTE ” (http://algorithms.blog55.fc2.com/ blog-entry-85.html)
  52. 52. • “ALGORITHM NOTE ” (http://algorithms.blog55.fc2.com/ blog-entry-85.html)
  53. 53. • “ALGORITHM NOTE ” (http://algorithms.blog55.fc2.com/ blog-entry-85.html)
  54. 54. • “ALGORITHM NOTE ” (http://algorithms.blog55.fc2.com/ blog-entry-85.html)
  55. 55. • “ALGORITHM NOTE ” (http://algorithms.blog55.fc2.com/ blog-entry-85.html)
  56. 56. • (N+1) * (W+1) • O(NW) •
  57. 57. DP • , •
  58. 58. DP • • • • • etc...
  59. 59. • Greedy Algorithm • , • • •
  60. 60. : 100 • “ : - ” (http://www.itmedia.co.jp/enterprise/articles/1009/04/news002.html)
  61. 61. Greedy • , • 15436 = {10000, 5000, 100, 100, 100, 100, 10, 10, 10, 5, 1}
  62. 62. • {1, 6, 13} • 18 • {13, 1, 1, 1, 1, 1} • {6, 6, 6}
  63. 63. • • • •
  64. 64. • • • • • • • etc...
  65. 65. • TopCoder • • • http://topcoder.g.hatena.ne.jp/keyword/Challenge • ,
  66. 66. •0 • • • •
  67. 67. • 3 • @iwiwi, @wata_orz, @kita__masa • • • http://www.amazon.co.jp/ - - /dp/4839931992
  68. 68. • •
  69. 69. Algorithm Tutorials • TopCoder • • • • http://www.topcoder.com/tc? module=Static&d1=tutorials &d2=alg_index
  70. 70. • chokudai • Imagine Cup 3 • • , • http://www.itmedia.co.jp/ keywords/algorithmer.html
  71. 71. • @kinaba • DP • http://www.kmonos.net/ wlog/89.html#_2049080923 • http://www.kmonos.net/ wlog/90.html#_1712081024 • http://www.kmonos.net/ wlog/91.html#_2024081109
  72. 72. • @kinaba topcoder-jp • http://twitter.com/#/list/kinaba/topcoder-jp • • ( ) • http://topcoder.g.hatena.ne.jp/ • • 60
  73. 73. • Introduction To TopCoder, TopCoder • http://d.hatena.ne.jp/cou929_la/ 20091005/1254725798 • • http://d.hatena.ne.jp/cou929_la/ 20100708/1278600922

×