SlideShare a Scribd company logo
1 of 6
Download to read offline
choi@startlink.io
https://www.acmicpc.net/problem/10986
• N 	
   	
  A1,	
  A2,	
  …,	
  AN	
  
• 	
   	
   	
   	
  M 	
   	
   	
   	
   	
  
• ,	
  Ai	
  +	
  …	
  +	
  Aj 	
  M 	
   	
   	
  (i,	
  j) 	
   	
  
• 1	
  ≤	
  N	
  ≤	
  106	
  
• 2	
  ≤	
  M	
  ≤	
  103	
  
• 0	
  ≤	
  Ai	
  ≤	
  109
https://www.acmicpc.net/problem/10986
• 	
   	
   	
  N^2 	
  
• O(N^2)	
  =	
  (10^6)^2	
  =	
  10^12	
  	
  
• 10^12	
  ≥	
  1 	
  
• !
	
  
https://www.acmicpc.net/problem/10986
• Si	
  =	
  A1	
  +	
  …	
  +	
  Ai	
   	
   	
  
• Ai +	
  …	
  +	
  Aj =	
  Sj – Si-­‐1
• (Ai +	
  …	
  +	
  Aj)	
  %	
  M	
  =	
  (Sj – Si-­‐1)	
  %	
  M
• (Ai +	
  …	
  +	
  Aj)	
  %	
  M	
  ==	
  0 	
   	
   	
   	
   	
  
• (Sj – Si-­‐1)	
  %	
  M ==	
  0	
   	
   	
  
• 	
   	
  0 	
   	
  
• Sj	
  %	
  M	
  ==	
  Si-­‐1	
  %	
  M	
   	
   	
   	
  
https://www.acmicpc.net/problem/10986
• 	
   	
  
• Sj %	
  M	
  ==	
  Si-­‐1 %	
  M
• 	
   	
  (i,	
  j)	
   	
   	
   	
   	
   .	
  
• cntk 	
  Si	
  %	
  M	
  ==	
  k	
   	
  i 	
   	
   	
  
• 0	
  ≤	
  k	
  <	
  M 	
  k 	
   	
  	
  
• cntk	
  *	
  (cntk	
  -­‐	
  1)	
  /	
  2	
   	
   	
   	
   .	
  
https://www.acmicpc.net/problem/10986
• https://gist.github.com/Baekjoon/6d45e5ef5d7eed6039b5	
  
	
  

More Related Content

Similar to Baekjoon Online Judge 10986번 풀이

Attention-Based Adaptive Selection of Operations for Image Restoration in the...
Attention-Based Adaptive Selection of Operations for Image Restoration in the...Attention-Based Adaptive Selection of Operations for Image Restoration in the...
Attention-Based Adaptive Selection of Operations for Image Restoration in the...MasanoriSuganuma
 
Al Fazl International 2nd January 2015
Al Fazl International 2nd January 2015Al Fazl International 2nd January 2015
Al Fazl International 2nd January 2015muzaffertahir9
 
Al Fazl International - 4th March 2016 Weekly UK
Al Fazl International - 4th March  2016 Weekly UKAl Fazl International - 4th March  2016 Weekly UK
Al Fazl International - 4th March 2016 Weekly UKmuzaffertahir9
 
Review: Cyrus, Samii, Laura Paler, and Sarah Zukerman Daly. 2016. “Retrospect...
Review: Cyrus, Samii, Laura Paler, and Sarah Zukerman Daly. 2016. “Retrospect...Review: Cyrus, Samii, Laura Paler, and Sarah Zukerman Daly. 2016. “Retrospect...
Review: Cyrus, Samii, Laura Paler, and Sarah Zukerman Daly. 2016. “Retrospect...Jaehyun Song
 
音響信号に対する異常音検知技術と応用
音響信号に対する異常音検知技術と応用音響信号に対する異常音検知技術と応用
音響信号に対する異常音検知技術と応用Yuma Koizumi
 
Festival Universitário de Surf 2014
Festival Universitário de Surf 2014Festival Universitário de Surf 2014
Festival Universitário de Surf 2014ibrasurf
 
Festival Universitário de Surf 2014
Festival Universitário de Surf 2014Festival Universitário de Surf 2014
Festival Universitário de Surf 2014Mari Peixoto
 
Nouveaux services, nouveaux workflows et François Abbe Mesclado
Nouveaux services, nouveaux workflows et François Abbe MescladoNouveaux services, nouveaux workflows et François Abbe Mesclado
Nouveaux services, nouveaux workflows et François Abbe MescladoMarc Bourhis
 
Наибольшая общая мера: 2500 лет
Наибольшая общая мера: 2500 летНаибольшая общая мера: 2500 лет
Наибольшая общая мера: 2500 летsixtyone
 
Companies act kenya.pdf
Companies act kenya.pdfCompanies act kenya.pdf
Companies act kenya.pdfMeshack Mwangi
 
16º Circuito Paulista Universitário de surf 2014 - 1ª Etapa
16º Circuito Paulista Universitário de surf 2014 - 1ª Etapa16º Circuito Paulista Universitário de surf 2014 - 1ª Etapa
16º Circuito Paulista Universitário de surf 2014 - 1ª Etapaibrasurf
 
Location and Language in Social Media (Stanford Mobi Social Invited Talk)
Location and Language in Social Media (Stanford Mobi Social Invited Talk)Location and Language in Social Media (Stanford Mobi Social Invited Talk)
Location and Language in Social Media (Stanford Mobi Social Invited Talk)Ed Chi
 

Similar to Baekjoon Online Judge 10986번 풀이 (16)

Attention-Based Adaptive Selection of Operations for Image Restoration in the...
Attention-Based Adaptive Selection of Operations for Image Restoration in the...Attention-Based Adaptive Selection of Operations for Image Restoration in the...
Attention-Based Adaptive Selection of Operations for Image Restoration in the...
 
Prelude to halide_public
Prelude to halide_publicPrelude to halide_public
Prelude to halide_public
 
Python lists
Python listsPython lists
Python lists
 
Al Fazl International 2nd January 2015
Al Fazl International 2nd January 2015Al Fazl International 2nd January 2015
Al Fazl International 2nd January 2015
 
Al Fazl International - 4th March 2016 Weekly UK
Al Fazl International - 4th March  2016 Weekly UKAl Fazl International - 4th March  2016 Weekly UK
Al Fazl International - 4th March 2016 Weekly UK
 
Review: Cyrus, Samii, Laura Paler, and Sarah Zukerman Daly. 2016. “Retrospect...
Review: Cyrus, Samii, Laura Paler, and Sarah Zukerman Daly. 2016. “Retrospect...Review: Cyrus, Samii, Laura Paler, and Sarah Zukerman Daly. 2016. “Retrospect...
Review: Cyrus, Samii, Laura Paler, and Sarah Zukerman Daly. 2016. “Retrospect...
 
音響信号に対する異常音検知技術と応用
音響信号に対する異常音検知技術と応用音響信号に対する異常音検知技術と応用
音響信号に対する異常音検知技術と応用
 
機械学習と自動微分
機械学習と自動微分機械学習と自動微分
機械学習と自動微分
 
Festival Universitário de Surf 2014
Festival Universitário de Surf 2014Festival Universitário de Surf 2014
Festival Universitário de Surf 2014
 
Festival Universitário de Surf 2014
Festival Universitário de Surf 2014Festival Universitário de Surf 2014
Festival Universitário de Surf 2014
 
Delta5 Summary
Delta5 SummaryDelta5 Summary
Delta5 Summary
 
Nouveaux services, nouveaux workflows et François Abbe Mesclado
Nouveaux services, nouveaux workflows et François Abbe MescladoNouveaux services, nouveaux workflows et François Abbe Mesclado
Nouveaux services, nouveaux workflows et François Abbe Mesclado
 
Наибольшая общая мера: 2500 лет
Наибольшая общая мера: 2500 летНаибольшая общая мера: 2500 лет
Наибольшая общая мера: 2500 лет
 
Companies act kenya.pdf
Companies act kenya.pdfCompanies act kenya.pdf
Companies act kenya.pdf
 
16º Circuito Paulista Universitário de surf 2014 - 1ª Etapa
16º Circuito Paulista Universitário de surf 2014 - 1ª Etapa16º Circuito Paulista Universitário de surf 2014 - 1ª Etapa
16º Circuito Paulista Universitário de surf 2014 - 1ª Etapa
 
Location and Language in Social Media (Stanford Mobi Social Invited Talk)
Location and Language in Social Media (Stanford Mobi Social Invited Talk)Location and Language in Social Media (Stanford Mobi Social Invited Talk)
Location and Language in Social Media (Stanford Mobi Social Invited Talk)
 

Recently uploaded

Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 

Recently uploaded (20)

Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 

Baekjoon Online Judge 10986번 풀이