SlideShare a Scribd company logo
Hacks
@cou929
Agenda
•

•

•

    •

    •

    •

    •

    •

    •

•
@cou929

•           (               )

• web

• Web technologies

    • HTML + CSS + JavaScript
•

•

• a.k.a.

    •

    •

    • etc.
.
    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
• n = 3, m = 10, k = {1, 2, 3, 5}

 • “Yes” ({1, 1, 3, 5}   )




• n = 3, m = 9, k = {1, 3, 5}

 • “No”
•


•



•



    •
•


    •


•4


    •     n      50



    • 1 <= n <= 1000   ?
TopCoder
•                     (       2, 3   )

    •                     !

• 1         2   3

•               (C++, Java, C#, VB)

•

• TopCoder

        •

        •       NASA

• http://www.topcoder.com/tc
Google Code Jam
•

• 2        3

    •                      2

•

• Google

    •             ?

• http://code.google.com/codejam
ACM ICPC
•

•

•

•

•                           ><

• http://cm.baylor.edu/welcome.icpc
• CodeForces

  • http://codeforces.ru/

• CodeChef

  • http://www.codechef.com/

• ICFP Programing Contest

  • http://icfpcontest.org/

• etc.
•            ,

    • ICPC

•

    •

•

•
• 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/
•

•

•

•

•

•
•

    •   ,   ,

•

    •

    •

•

    •
•

•

•
•       “   ”

    •

    •
                ,

•
•

•

•
•   ->   ->   ! ->



•   ->   ->          !




•

•
•             ->    ->
    ->             ->    ->
         ->




•

•
•

    •   O-

•

•
O-
•

    •     O(log n), O(n^3)

•

    •

    •

    • 3   -> O(n^3)          !

•

    •           .
•                 ,n        50

•                  O(n^4)

    • 6,250,000
•          2


     1,000,000

    100,000,000

    1,000,000,000
•

•

    •     (dfs)

    •   (bfs)

•

    •

    •
:
 • O(n^4)

 • n=3



               n1                  n2             n3



     n1        n2   n3        n1   n2   n3   n1   n2   n3



n1   n2   n3        n1   n2   n3    ……
                               ……
•   http://www.itmedia.co.jp/enterprise/articles/1001/16/news001.html
•   ,



•

•
:
     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
•          a_i         ,   /

•        a_i



•          O(2^n)

•n             20

• 2 ^ 20 = 1,048,576
•   “                            :                       -        ”   (http://
    www.itmedia.co.jp/enterprise/articles/1001/16/news001.html)
•

    • dfs

•

    • dfs                bfs

      •

•           O(   *   )
:

•
     :



• http://okajima.air-
  nifty.com/b/2010/01/
  post-abc6.html
:



                         ,         N, M                   .
N = M = 50




• http://okajima.air-nifty.com/b/2010/01/post-abc6.html
:
                   **************************
                   *S* *                       *
                   * * * * ************* *
                   * *     *      ************ *
                   *     *                     *
                   ************** ***********
                   *                           *
                   ** ***********************
                   *         *               G *
                   * *           *********** * *
                   *     *           ******* * *
                   *           *               *
                   **************************


• http://okajima.air-nifty.com/b/2010/01/post-abc6.html
:
                   **************************
                   *S* * $$$                *
                   *$* *$$*$ ************* *
                   *$* $$* $$$************ *
                   *$$$$*    $$$$$          *
                   **************$***********
                   * $$$$$$$$$$$$$          *
                   **$***********************
                   * $$$$$*$$$$$$$$$$$$$$G *
                   * * $$$ *********** * *
                   *    *        ******* * *
                   *       *                *
                   **************************


• http://okajima.air-nifty.com/b/2010/01/post-abc6.html
•         N*M

•             4

•                  O(N * M * 4)

• 50 * 50 * 4 = 10,000
•                     ,



•       :

    •          m

•           dfs bfs

•
• Binary Search

•

•         O(log(n))
•   http://www.gutterbucket.com/general-code/binary-search.html
• Dynamic Programming,   DP

•              ,



•
:


      w         v           N        ,               W
                 .      ,                W      ,
                                 .




• “ALGORITHM NOTE           ”   (http://algorithms.blog55.fc2.com/
  blog-entry-85.html)
•N                       /
     2

• O(2^N)

•N         100   , 2^100 = 10^30
DP

• (N+1) * (W+1)       C

• C[i][w]         w       0
       i
• C[i][w]         2

 • C[i - 1][w -       i   ]+   i

 • C[i - 1][w]
• “ALGORITHM NOTE       ”   (http://algorithms.blog55.fc2.com/
  blog-entry-85.html)
• “ALGORITHM NOTE       ”   (http://algorithms.blog55.fc2.com/
  blog-entry-85.html)
• “ALGORITHM NOTE       ”   (http://algorithms.blog55.fc2.com/
  blog-entry-85.html)
• “ALGORITHM NOTE       ”   (http://algorithms.blog55.fc2.com/
  blog-entry-85.html)
• “ALGORITHM NOTE       ”   (http://algorithms.blog55.fc2.com/
  blog-entry-85.html)
• “ALGORITHM NOTE       ”   (http://algorithms.blog55.fc2.com/
  blog-entry-85.html)
• “ALGORITHM NOTE       ”   (http://algorithms.blog55.fc2.com/
  blog-entry-85.html)
• “ALGORITHM NOTE       ”   (http://algorithms.blog55.fc2.com/
  blog-entry-85.html)
• “ALGORITHM NOTE       ”   (http://algorithms.blog55.fc2.com/
  blog-entry-85.html)
• (N+1) * (W+1)

• O(NW)

•
DP

•        ,



•
DP
•

•

•

•

• etc...
• Greedy Algorithm

•                    ,

    •

•

    •
:


100




• “                            :                           -                ”
      (http://www.itmedia.co.jp/enterprise/articles/1009/04/news002.html)
Greedy

•                   ,



• 15436 = {10000, 5000, 100, 100, 100,
  100, 10, 10, 10, 5, 1}
• {1, 6, 13}

• 18

 • {13, 1, 1, 1, 1, 1}

 • {6, 6, 6}
•

•



•

    •
•

    •

    •

•

    •

    •

• etc...
• TopCoder



    •

•

    • http://topcoder.g.hatena.ne.jp/keyword/Challenge



•          ,
•0

•

•

    •

    •
•                       3



    • @iwiwi, @wata_orz, @kita__masa

•



•



• http://www.amazon.co.jp/
                                 -
       -    /dp/4839931992
•


•
Algorithm Tutorials
• TopCoder



•


•


•


• http://www.topcoder.com/tc?
  module=Static&d1=tutorials
  &d2=alg_index
• chokudai


    • Imagine Cup   3



•


    •
        ,



• http://www.itmedia.co.jp/
  keywords/algorithmer.html
• @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
• @kinaba          topcoder-jp


    • http://twitter.com/#/list/kinaba/topcoder-jp

    •


•                  (              )


    • http://topcoder.g.hatena.ne.jp/

    •


    •    60
• Introduction To TopCoder,              TopCoder


    • http://d.hatena.ne.jp/cou929_la/
      20091005/1254725798

•


    • http://d.hatena.ne.jp/cou929_la/
      20100708/1278600922
Programming Contest Hacks

More Related Content

What's hot

Nghien cuu cong_nghe_sx_dich_dam,_bot_ca
Nghien cuu cong_nghe_sx_dich_dam,_bot_caNghien cuu cong_nghe_sx_dich_dam,_bot_ca
Nghien cuu cong_nghe_sx_dich_dam,_bot_ca
saomai491
 
Cameroun - Repertoire des projets prioritaires à besoins de financement
Cameroun - Repertoire des projets prioritaires à besoins de financementCameroun - Repertoire des projets prioritaires à besoins de financement
Cameroun - Repertoire des projets prioritaires à besoins de financement
investincameroon
 
Report of the Export Group on the methodology for the people below the povert...
Report of the Export Group on the methodology for the people below the povert...Report of the Export Group on the methodology for the people below the povert...
Report of the Export Group on the methodology for the people below the povert...
People's Archive of Rural India
 
Moosecon native apps_blackberry_10-optimized
Moosecon native apps_blackberry_10-optimizedMoosecon native apps_blackberry_10-optimized
Moosecon native apps_blackberry_10-optimized
Heinrich Seeger
 
Dialnet el complementodirectopreposicionalenelcastellanodel-918722
Dialnet el complementodirectopreposicionalenelcastellanodel-918722Dialnet el complementodirectopreposicionalenelcastellanodel-918722
Dialnet el complementodirectopreposicionalenelcastellanodel-918722
arpad203
 
التأصيل الطبي للضرورة الطبية
التأصيل الطبي للضرورة الطبيةالتأصيل الطبي للضرورة الطبية
التأصيل الطبي للضرورة الطبية
Dr Ghaiath Hussein
 
Global Change, Species Diversity, and the Future of Marine Ecosystems
Global Change, Species Diversity, and the Future of Marine EcosystemsGlobal Change, Species Diversity, and the Future of Marine Ecosystems
Global Change, Species Diversity, and the Future of Marine Ecosystems
Jarrett Byrnes
 
Dipôles linéaires, régime transitoire
Dipôles linéaires, régime transitoireDipôles linéaires, régime transitoire
Dipôles linéaires, régime transitoire
Achraf Ourti
 
Replica Sets
Replica SetsReplica Sets
Replica Sets
MongoDB
 

What's hot (20)

Matrices, Matrix
Matrices, MatrixMatrices, Matrix
Matrices, Matrix
 
Nghien cuu cong_nghe_sx_dich_dam,_bot_ca
Nghien cuu cong_nghe_sx_dich_dam,_bot_caNghien cuu cong_nghe_sx_dich_dam,_bot_ca
Nghien cuu cong_nghe_sx_dich_dam,_bot_ca
 
Hajj or Umra by Shykh Bin Baz
Hajj or Umra by Shykh Bin BazHajj or Umra by Shykh Bin Baz
Hajj or Umra by Shykh Bin Baz
 
Cameroun - Repertoire des projets prioritaires à besoins de financement
Cameroun - Repertoire des projets prioritaires à besoins de financementCameroun - Repertoire des projets prioritaires à besoins de financement
Cameroun - Repertoire des projets prioritaires à besoins de financement
 
Who was william shakespeare ?
Who was william shakespeare ?Who was william shakespeare ?
Who was william shakespeare ?
 
Etransformation de l'éducation avant le bac
Etransformation de l'éducation avant le bacEtransformation de l'éducation avant le bac
Etransformation de l'éducation avant le bac
 
Report of the Export Group on the methodology for the people below the povert...
Report of the Export Group on the methodology for the people below the povert...Report of the Export Group on the methodology for the people below the povert...
Report of the Export Group on the methodology for the people below the povert...
 
Moosecon native apps_blackberry_10-optimized
Moosecon native apps_blackberry_10-optimizedMoosecon native apps_blackberry_10-optimized
Moosecon native apps_blackberry_10-optimized
 
If you can
If you canIf you can
If you can
 
Ecuacionesfuncionales2 1
Ecuacionesfuncionales2 1Ecuacionesfuncionales2 1
Ecuacionesfuncionales2 1
 
Dialnet el complementodirectopreposicionalenelcastellanodel-918722
Dialnet el complementodirectopreposicionalenelcastellanodel-918722Dialnet el complementodirectopreposicionalenelcastellanodel-918722
Dialnet el complementodirectopreposicionalenelcastellanodel-918722
 
التأصيل الطبي للضرورة الطبية
التأصيل الطبي للضرورة الطبيةالتأصيل الطبي للضرورة الطبية
التأصيل الطبي للضرورة الطبية
 
A Little Bit Of Insight 2011
A Little Bit Of Insight 2011A Little Bit Of Insight 2011
A Little Bit Of Insight 2011
 
Tecnicas de sql injection
Tecnicas de sql injectionTecnicas de sql injection
Tecnicas de sql injection
 
Global Change, Species Diversity, and the Future of Marine Ecosystems
Global Change, Species Diversity, and the Future of Marine EcosystemsGlobal Change, Species Diversity, and the Future of Marine Ecosystems
Global Change, Species Diversity, and the Future of Marine Ecosystems
 
Technorati Blogging Stats Preview
Technorati Blogging Stats PreviewTechnorati Blogging Stats Preview
Technorati Blogging Stats Preview
 
Dipôles linéaires, régime transitoire
Dipôles linéaires, régime transitoireDipôles linéaires, régime transitoire
Dipôles linéaires, régime transitoire
 
Nic newman tiger spike mobile publishing masterclass
Nic newman tiger spike mobile publishing masterclassNic newman tiger spike mobile publishing masterclass
Nic newman tiger spike mobile publishing masterclass
 
PR Campaign Proposal
PR Campaign ProposalPR Campaign Proposal
PR Campaign Proposal
 
Replica Sets
Replica SetsReplica Sets
Replica Sets
 

Viewers also liked

Viewers also liked (7)

Object meta-level control on ECMA Script 5
Object meta-level control on ECMA Script 5Object meta-level control on ECMA Script 5
Object meta-level control on ECMA Script 5
 
C language Sem 01
C language Sem 01C language Sem 01
C language Sem 01
 
Survey of the Ontology - オントロジーについての調査
Survey of the Ontology - オントロジーについての調査Survey of the Ontology - オントロジーについての調査
Survey of the Ontology - オントロジーについての調査
 
Introduction To Google App Engine
Introduction To Google App EngineIntroduction To Google App Engine
Introduction To Google App Engine
 
Firefox 学生向けアドオンパック
Firefox 学生向けアドオンパックFirefox 学生向けアドオンパック
Firefox 学生向けアドオンパック
 
Chrome Web Store に登録してみた
Chrome Web Store に登録してみたChrome Web Store に登録してみた
Chrome Web Store に登録してみた
 
C言語演習(2) - OpenCV
C言語演習(2) - OpenCV C言語演習(2) - OpenCV
C言語演習(2) - OpenCV
 

Similar to Programming Contest Hacks

Steering Iterative and Incremental Delivery with Jeff Patton
Steering Iterative and Incremental Delivery with Jeff PattonSteering Iterative and Incremental Delivery with Jeff Patton
Steering Iterative and Incremental Delivery with Jeff Patton
UIEpreviews
 
Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made...
Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made...Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made...
Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made...
Rick G. Garibay
 
HadoopとMongoDBを活用したソーシャルアプリのログ解析
HadoopとMongoDBを活用したソーシャルアプリのログ解析HadoopとMongoDBを活用したソーシャルアプリのログ解析
HadoopとMongoDBを活用したソーシャルアプリのログ解析
Takahiro Inoue
 

Similar to Programming Contest Hacks (20)

Py "Baseball" Data入門〜サービス(と野球)を支えるデータ分析基盤 #monotarotech
Py "Baseball" Data入門〜サービス(と野球)を支えるデータ分析基盤 #monotarotechPy "Baseball" Data入門〜サービス(と野球)を支えるデータ分析基盤 #monotarotech
Py "Baseball" Data入門〜サービス(と野球)を支えるデータ分析基盤 #monotarotech
 
Leadership Guide, 초보팀장을 위한 리더십 가이드
Leadership Guide, 초보팀장을 위한 리더십 가이드Leadership Guide, 초보팀장을 위한 리더십 가이드
Leadership Guide, 초보팀장을 위한 리더십 가이드
 
Tabledown
TabledownTabledown
Tabledown
 
Steering Iterative and Incremental Delivery with Jeff Patton
Steering Iterative and Incremental Delivery with Jeff PattonSteering Iterative and Incremental Delivery with Jeff Patton
Steering Iterative and Incremental Delivery with Jeff Patton
 
Mining the Geo Needles in the Social Haystack
Mining the Geo Needles in the Social HaystackMining the Geo Needles in the Social Haystack
Mining the Geo Needles in the Social Haystack
 
第5回NIPS読み会・関西発表資料
第5回NIPS読み会・関西発表資料第5回NIPS読み会・関西発表資料
第5回NIPS読み会・関西発表資料
 
신뢰성 높은 클라우드 기반 서비스 운영을 위한 Chaos Engineering in Action (윤석찬, AWS 테크에반젤리스트) :: ...
신뢰성 높은 클라우드 기반 서비스 운영을 위한 Chaos Engineering in Action (윤석찬, AWS 테크에반젤리스트) :: ...신뢰성 높은 클라우드 기반 서비스 운영을 위한 Chaos Engineering in Action (윤석찬, AWS 테크에반젤리스트) :: ...
신뢰성 높은 클라우드 기반 서비스 운영을 위한 Chaos Engineering in Action (윤석찬, AWS 테크에반젤리스트) :: ...
 
Onsg10 Intro Termtter
Onsg10 Intro TermtterOnsg10 Intro Termtter
Onsg10 Intro Termtter
 
Casual-Talk #1 青虫の生態について
Casual-Talk #1 青虫の生態についてCasual-Talk #1 青虫の生態について
Casual-Talk #1 青虫の生態について
 
App과 Server의 은밀한 대화
App과 Server의 은밀한 대화App과 Server의 은밀한 대화
App과 Server의 은밀한 대화
 
Czzawk
CzzawkCzzawk
Czzawk
 
Vim - Amazing Editor for DBAs
Vim - Amazing Editor for DBAsVim - Amazing Editor for DBAs
Vim - Amazing Editor for DBAs
 
katagaitai CTF workshop #10 AESに対する相関電力解析
katagaitai CTF workshop #10 AESに対する相関電力解析katagaitai CTF workshop #10 AESに対する相関電力解析
katagaitai CTF workshop #10 AESに対する相関電力解析
 
Happy Go Programming
Happy Go ProgrammingHappy Go Programming
Happy Go Programming
 
Training evaluation workshop ver 00
Training evaluation workshop ver 00Training evaluation workshop ver 00
Training evaluation workshop ver 00
 
[DL輪読会]Tracking Emerges by Colorizing Videos
[DL輪読会]Tracking Emerges by Colorizing Videos[DL輪読会]Tracking Emerges by Colorizing Videos
[DL輪読会]Tracking Emerges by Colorizing Videos
 
Game Day in Action for Chaos Engineering - 윤석찬 (AWS 테크에반젤리스트) :: 한국 카오스엔지니어링 밋업
Game Day in Action for Chaos Engineering - 윤석찬 (AWS 테크에반젤리스트) ::  한국 카오스엔지니어링 밋업Game Day in Action for Chaos Engineering - 윤석찬 (AWS 테크에반젤리스트) ::  한국 카오스엔지니어링 밋업
Game Day in Action for Chaos Engineering - 윤석찬 (AWS 테크에반젤리스트) :: 한국 카오스엔지니어링 밋업
 
[表示が崩れる場合ダウンロードしてご覧ください] 2018年のDocker・Moby
[表示が崩れる場合ダウンロードしてご覧ください] 2018年のDocker・Moby[表示が崩れる場合ダウンロードしてご覧ください] 2018年のDocker・Moby
[表示が崩れる場合ダウンロードしてご覧ください] 2018年のDocker・Moby
 
Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made...
Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made...Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made...
Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made...
 
HadoopとMongoDBを活用したソーシャルアプリのログ解析
HadoopとMongoDBを活用したソーシャルアプリのログ解析HadoopとMongoDBを活用したソーシャルアプリのログ解析
HadoopとMongoDBを活用したソーシャルアプリのログ解析
 

Recently uploaded

Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Peter Udo Diehl
 

Recently uploaded (20)

Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 

Programming Contest Hacks

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

Editor's Notes