SlideShare a Scribd company logo
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

PDF
Baekjoon Online Judge 2873번 풀이
PDF
2014 ACM-ICPC Daejeon 인터넷 예선 해설
PDF
Baekjoon Online Judge 1201번 풀이
PDF
Baekjoon Online Judge 1019번 풀이
PDF
Baekjoon Online Judge 3015번 풀이
PDF
Baekjoon Online Judge 1451번 풀이
PDF
Baekjoon Online Judge 1648번 풀이
PPTX
Do not use the greater than sign in programming
Baekjoon Online Judge 2873번 풀이
2014 ACM-ICPC Daejeon 인터넷 예선 해설
Baekjoon Online Judge 1201번 풀이
Baekjoon Online Judge 1019번 풀이
Baekjoon Online Judge 3015번 풀이
Baekjoon Online Judge 1451번 풀이
Baekjoon Online Judge 1648번 풀이
Do not use the greater than sign in programming

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

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

Recently uploaded (20)

DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
cuic standard and advanced reporting.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Modernizing your data center with Dell and AMD
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Big Data Technologies - Introduction.pptx
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
NewMind AI Weekly Chronicles - August'25 Week I
The AUB Centre for AI in Media Proposal.docx
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
cuic standard and advanced reporting.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Modernizing your data center with Dell and AMD
Per capita expenditure prediction using model stacking based on satellite ima...
Review of recent advances in non-invasive hemoglobin estimation
Big Data Technologies - Introduction.pptx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Spectral efficient network and resource selection model in 5G networks
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Reach Out and Touch Someone: Haptics and Empathic Computing
The Rise and Fall of 3GPP – Time for a Sabbatical?
Digital-Transformation-Roadmap-for-Companies.pptx
Understanding_Digital_Forensics_Presentation.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
NewMind AI Weekly Chronicles - August'25 Week I
Ad

Baekjoon Online Judge 10986번 풀이