{"problem":{"name":"125. Chord Identification","description":{"content":"You're listening to music, and you hear a major chord of three notes. You want to figure out which chord you just heard. In music, the notes in a single octave, from lowest to highest, are as follows","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10269125"},"statements":[{"statement_type":"Markdown","content":"You're listening to music, and you hear a major chord of three notes. You want to figure out which chord you just heard.\n\nIn music, the notes in a single octave, from lowest to highest, are as follows: C, C#, D, D#, E, F, F#, G, G#, A, A#, and B. Any two adjacent notes in this list are a \"half step\" apart. For example, C and D differ by 2 half steps, and A and D differ by 5 half steps.\n\nAdditionally, notes can be represented as both sharps and flats. For example, C# and D ♭ (D flat) are the same note, and D# and E ♭ are the same note. A flat note will be represented with a lowercase f in the input, such as \"Df\" for D flat.\n\nA major chord has a $r o o t$, a $t h i r d$ note, and a $f i f t h$ note. The root and the third note must differ by exactly four half steps, and the third and fifth note must differ by exactly three half steps. Correspondingly, the root and the fifth note must differ by exactly seven half steps.\n\nGiven this information, and a major chord, figure out what the root of the chord is. *The notes of the chord can be given in any order, i.e. the root doesn't necessarily come first.*\n\nThe only line of input contain three space-separated notes. It is guaranteed that the notes form a major chord with the root being one of the three notes.\n\nOutput a single note: the root of the chord.\n\n## Input\n\nThe only line of input contain three space-separated notes. It is guaranteed that the notes form a major chord with the root being one of the three notes.\n\n## Output\n\nOutput a single note: the root of the chord.\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ N = \\{C, C\\#, D, D\\#, E, F, F\\#, G, G\\#, A, A\\#, B\\} $ be the set of 12 pitch classes in one octave, ordered cyclically.  \nLet $ f: N \\to \\mathbb{Z}_{12} $ be the mapping:  \n$ f(C) = 0, f(C\\#) = 1, f(D) = 2, f(D\\#) = 3, f(E) = 4, f(F) = 5, f(F\\#) = 6, f(G) = 7, f(G\\#) = 8, f(A) = 9, f(A\\#) = 10, f(B) = 11 $.  \nDefine equivalent representations: $ C\\# \\equiv Df $, $ D\\# \\equiv Ef $, $ F\\# \\equiv Gf $, $ G\\# \\equiv Af $, $ A\\# \\equiv Bf $.  \nLet $ S = \\{n_1, n_2, n_3\\} \\subseteq N $ be the three input notes (in any order), each normalized to sharp form via equivalence.\n\n**Constraints**  \n1. $ S $ forms a major chord: there exists a root $ r \\in S $ such that the other two notes $ n_i, n_j \\in S \\setminus \\{r\\} $ satisfy:  \n   $$\n   |f(n_i) - f(r)|_{12} = 4 \\quad \\text{and} \\quad |f(n_j) - f(n_i)|_{12} = 3\n   $$  \n   (where $ |x|_{12} $ denotes the minimal circular distance modulo 12).  \n2. Equivalently: the three notes correspond to pitch classes $ \\{r, r+4, r+7\\} \\mod 12 $.\n\n**Objective**  \nFind $ r \\in S $ such that $ \\{f(r), f(r)+4, f(r)+7\\} \\mod 12 = \\{f(n_1), f(n_2), f(n_3)\\} $.  \nOutput the note name corresponding to $ r $.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10269125","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}