Codeforces Round #673 (Div. 2)
A. Copy-paste
簽到題
題設:給一串長度為n,值可變的陣列,和最大限度k,每次可選擇[1 , n]範圍內任意不相等的兩序號(i,j),使 a[ j ] = a[ j ] + a[ i ],當陣列中最大值會超過k(a[max]>k)時不可繼續操作,問最多可操作的次數。
思路:用小頂堆的優先佇列儲存所有值,先取出最小值並將其彈出,再將第二大的值加到最小值上,將求和後的該值再插入優先佇列,重複操作至最小值會超過k時停止。
——題解
B. Two Arrays
思維題
題設:給定一串長度為n陣列,和不幸值“T”,要求將此陣列拆分成兩個子陣列,並希望拆分後,對於屬於同一陣列兩個元素,相加等於T的情況儘可能少,要求將所有元素拆分的情況輸出,輸出值為1的放在黑色陣列中,輸出值為0則放在白色陣列中。
思路:對T進行情況考慮,先取一int型的值mid=T/2。若T為奇數,將所有小於mid的元素放在黑色數字中,大於等於mid的放在另一白色陣列中;若T為偶數,則等於mid的元素要儘可能均分到兩個陣列中,則只需在奇數情況下,將所有等於mid的值交錯放置。
——題解
相關文章
- Codeforces Round #673 (Div. 2)(A-D)題解
- Codeforces Round #541 (Div. 2)
- Codeforces Round 940 (Div. 2)
- Codeforces Round 934 (Div. 2)
- Codeforces Round 932 (Div. 2)
- Codeforces Round 948 (Div. 2)
- Codeforces Round #639 (Div. 2)
- Codeforces Round #672 (Div. 2)
- Codeforces Round #682 (Div. 2)
- Codeforces Round #678 (Div. 2)
- Codeforces Round 987 (Div. 2)
- Codeforces Round 976 (Div. 2)
- Codeforces Round 975 (Div. 2)
- Codeforces Round 986 (Div. 2)
- Codeforces Round 973 (Div. 2)
- Codeforces Round 969 (Div. 2)
- Codeforces Round 873 (Div. 2)
- Codeforces Round 967 (Div. 2)
- Codeforces Round 965 (Div. 2)
- Codeforces Round 963 (Div. 2)
- Codeforces Round 979 (Div. 2)
- Codeforces Round 972 (Div. 2)
- Codeforces Round 949 (Div. 2)
- Codeforces Round 955 (Div. 2)
- Codeforces Round 951 (Div. 2)
- Codeforces Round 961 (Div. 2)
- Codeforces Round 958 (Div. 2)
- Codeforces Round 960 (Div. 2)
- Codeforces Round 953 (Div. 2)
- Codeforces Round 982 (Div. 2)
- Codeforces Round 945 (Div. 2)
- Codeforces Round #747 (Div. 2)
- Codeforces Round 947 (Div. 1 + Div. 2)
- Codeforces Round 941 (Div. 2) D
- Codeforces Round 932 (Div. 2) ABCD
- Codeforces Round 945 (Div. 2) (A - E)
- Codeforces Round 892 (Div. 2) E
- Codeforces Round 936 (Div. 2) E