版本比较
题解:P3836 [IOI 2017] Nowruz
正文
增加 19 行删除 19 行
300 行未改动全部展开301302303304305306307308309524 行未改动全部展开834835836837838839840841842548 行未改动全部展开13911392139313941395139613971398139929 行未改动142914301431143214331434143514361437143814391440144114421443255 行未改动全部展开169917001701170217031704170517061707484 行未改动全部展开219221932194219521962197219821992200223 行未改动全部展开242424252426242724282429243024312432952 行未改动全部展开33853386338733883389339033913392339317 行未改动34113412341334143415341634173418341975 行未改动34953496349734983499350035013502350312 行未改动351635173518351935203521352235233524816 行未改动全部展开43414342434343444345434643474348434943504351312 行未改动全部展开466446654666466746684669467046714672102 行未改动全部展开477547764777477847794780478147824783433 行未改动全部展开52175218521952205221522252235224522577 行未改动53035304530553065307530853095310531131 行未改动534353445345534653475348534953505351176 行未改动全部展开300 行未改动全部展开__first += __remainder;__tailSize -= __remainder;// __first here is always pointing to one past the last element of// next possible match._RandomAccessIter __backTrack = __first;while (__unary_pred(--__backTrack)){if (--__remainder == 0)return (__first - __count); // Success524 行未改动全部展开typename iterator_traits<_InputIterator>::value_type>)__glibcxx_function_requires(_UnaryPredicateConcept<_Predicate,typename iterator_traits<_InputIterator>::value_type>)__glibcxx_requires_valid_range(__first, __last);for (; __first != __last; ++__first)if (__pred(*__first)){*__out_true = *__first;548 行未改动全部展开* @param __middle A forward iterator.* @param __last A forward iterator.* @return Nothing.** Rotates the elements of the range @p [__first,__last) by* @p (__middle - __first) positions so that the element at @p __middle* is moved to @p __first, the element at @p __middle+1 is moved to* @p __first+1 and so on for each element in the range* @p [__first,__last).29 行未改动* @param __result An output iterator.* @return An iterator designating the end of the resulting sequence.** Copies the elements of the range @p [__first,__last) to the* range beginning at @result, rotating the copied elements by* @p (__middle-__first) positions so that the element at @p __middle* is moved to @p __result, the element at @p __middle+1 is moved* to @p __result+1 and so on for each element in the range @p* [__first,__last).** Performs* @p *(__result+(n+(__last-__middle))%(__last-__first))=*(__first+n)* for each @p n in the range @p [0,__last-__first).*/template<typename _ForwardIterator, typename _OutputIterator>255 行未改动全部展开*__result_real_last = *__first;++__result_real_last;++__first;}std::__make_heap(__result_first, __result_real_last, __comp);while (__first != __last){if (__comp(__first, __result_first))484 行未改动全部展开__glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)__glibcxx_function_requires(_LessThanOpConcept<_ValueType, _Tp>)__glibcxx_function_requires(_LessThanOpConcept<_Tp, _ValueType>)__glibcxx_requires_partitioned_lower(__first, __last, __val);__glibcxx_requires_partitioned_upper(__first, __last, __val);return std::__equal_range(__first, __last, __val,__gnu_cxx::__ops::__iter_less_val(),__gnu_cxx::__ops::__val_less_iter());223 行未改动全部展开}}/// This is a helper function for the merge routines.template<typename _BidirectionalIterator, typename _Distance,typename _Pointer, typename _Compare>void__merge_adaptive(_BidirectionalIterator __first,_BidirectionalIterator __middle,952 行未改动全部展开* elements in a range.* @ingroup sorting_algorithms* @param __first Start of range.* @param __last End of range.* @return make_pair(m, M), where m is the first iterator i in* [__first, __last) such that no other element in the range is* smaller, and where M is the last iterator i in [__first, __last)* such that no other element in the range is larger.*/17 行未改动* @ingroup sorting_algorithms* @param __first Start of range.* @param __last End of range.* @param __comp Comparison functor.* @return make_pair(m, M), where m is the first iterator i in* [__first, __last) such that no other element in the range is* smaller, and where M is the last iterator i in [__first, __last)* such that no other element in the range is larger.*/75 行未改动{if (__scan != std::__find_if(__first1, __scan,__gnu_cxx::__ops::__iter_comp_iter(__pred, __scan)))continue; // We've seen this one before.auto __matches= std::__count_if(__first2, __last2,__gnu_cxx::__ops::__iter_comp_iter(__pred, __scan));if (0 == __matches ||12 行未改动* @param __first1 Start of first range.* @param __last1 End of first range.* @param __first2 Start of second range.* @return true if there exists a permutation of the elements in the range* [__first2, __first2 + (__last1 - __first1)), beginning with* ForwardIterator2 begin, such that equal(__first1, __last1, begin)* returns true; otherwise, returns false.*/template<typename _ForwardIterator1, typename _ForwardIterator2>816 行未改动全部展开* copied is unchanged.** _GLIBCXX_RESOLVE_LIB_DEFECTS* DR 241. Does unique_copy() require CopyConstructible and Assignable?** _GLIBCXX_RESOLVE_LIB_DEFECTS* DR 538. 241 again: Does unique_copy() require CopyConstructible and* Assignable?*/template<typename _InputIterator, typename _OutputIterator>inline _OutputIterator312 行未改动全部展开* @param __last Another iterator.* @return Nothing.** Sorts the elements in the range @p [__first,__last) in ascending order,* such that for each iterator @e i in the range @p [__first,__last-1),* *(i+1)<*i is false.** The relative ordering of equivalent elements is not preserved, use* @p stable_sort() if this is needed.102 行未改动全部展开__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,typename iterator_traits<_InputIterator2>::value_type>)__glibcxx_function_requires(_LessThanOpConcept<typename iterator_traits<_InputIterator2>::value_type,typename iterator_traits<_InputIterator1>::value_type>)__glibcxx_requires_sorted_set(__first1, __last1, __first2);__glibcxx_requires_sorted_set(__first2, __last2, __first1);return _GLIBCXX_STD_A::__merge(__first1, __last1,433 行未改动全部展开typename iterator_traits<_InputIterator1>::value_type,typename iterator_traits<_InputIterator2>::value_type>)__glibcxx_function_requires(_LessThanOpConcept<typename iterator_traits<_InputIterator2>::value_type,typename iterator_traits<_InputIterator1>::value_type>)__glibcxx_requires_sorted_set(__first1, __last1, __first2);__glibcxx_requires_sorted_set(__first2, __last2, __first1);return _GLIBCXX_STD_A::__set_difference(__first1, __last1,77 行未改动{++__first1;++__first2;}return std::copy(__first2, __last2,std::copy(__first1, __last1, __result));}/**31 行未改动typename iterator_traits<_InputIterator1>::value_type,typename iterator_traits<_InputIterator2>::value_type>)__glibcxx_function_requires(_LessThanOpConcept<typename iterator_traits<_InputIterator2>::value_type,typename iterator_traits<_InputIterator1>::value_type>)__glibcxx_requires_sorted_set(__first1, __last1, __first2);__glibcxx_requires_sorted_set(__first2, __last2, __first1);return _GLIBCXX_STD_A::__set_symmetric_difference(__first1, __last1,176 行未改动全部展开300 行未改动全部展开301302303304305306307308309524 行未改动全部展开834835836837838839840841842548 行未改动全部展开13911392139313941395139613971398139929 行未改动142914301431143214331434143514361437143814391440144114421443255 行未改动全部展开169917001701170217031704170517061707484 行未改动全部展开219221932194219521962197219821992200223 行未改动全部展开242424252426242724282429243024312432952 行未改动全部展开33853386338733883389339033913392339317 行未改动34113412341334143415341634173418341975 行未改动34953496349734983499350035013502350312 行未改动351635173518351935203521352235233524816 行未改动全部展开43414342434343444345434643474348434943504351312 行未改动全部展开466446654666466746684669467046714672102 行未改动全部展开477547764777477847794780478147824783433 行未改动全部展开52175218521952205221522252235224522577 行未改动53035304530553065307530853095310531131 行未改动534353445345534653475348534953505351176 行未改动全部展开300 行未改动全部展开__first += __remainder;__tailSize -= __remainder;// __first here is always pointing to one past the last element of// next possible match._RandomAccessIter __backTrack = __first;while (__unary_pred(--__backTrack)){if (--__remainder == 0)return (__first - __count); // Success524 行未改动全部展开typename iterator_traits<_InputIterator>::value_type>)__glibcxx_function_requires(_UnaryPredicateConcept<_Predicate,typename iterator_traits<_InputIterator>::value_type>)__glibcxx_requires_valid_range(__first, __last);for (; __first != __last; ++__first)if (__pred(*__first)){*__out_true = *__first;548 行未改动全部展开* @param __middle A forward iterator.* @param __last A forward iterator.* @return Nothing.** Rotates the elements of the range @p [__first,__last) by* @p (__middle - __first) positions so that the element at @p __middle* is moved to @p __first, the element at @p __middle+1 is moved to* @p __first+1 and so on for each element in the range* @p [__first,__last).29 行未改动* @param __result An output iterator.* @return An iterator designating the end of the resulting sequence.** Copies the elements of the range @p [__first,__last) to the* range beginning at @result, rotating the copied elements by* @p (__middle-__first) positions so that the element at @p __middle* is moved to @p __result, the element at @p __middle+1 is moved* to @p __result+1 and so on for each element in the range @p* [__first,__last).** Performs* @p *(__result+(n+(__last-__middle))%(__last-__first))=*(__first+n)* for each @p n in the range @p [0,__last-__first).*/template<typename _ForwardIterator, typename _OutputIterator>255 行未改动全部展开*__result_real_last = *__first;++__result_real_last;++__first;}std::__make_heap(__result_first, __result_real_last, __comp);while (__first != __last){if (__comp(__first, __result_first))484 行未改动全部展开__glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)__glibcxx_function_requires(_LessThanOpConcept<_ValueType, _Tp>)__glibcxx_function_requires(_LessThanOpConcept<_Tp, _ValueType>)__glibcxx_requires_partitioned_lower(__first, __last, __val);__glibcxx_requires_partitioned_upper(__first, __last, __val);return std::__equal_range(__first, __last, __val,__gnu_cxx::__ops::__iter_less_val(),__gnu_cxx::__ops::__val_less_iter());223 行未改动全部展开}}/// This is a helper function for the merge routines.template<typename _BidirectionalIterator, typename _Distance,typename _Pointer, typename _Compare>void__merge_adaptive(_BidirectionalIterator __first,_BidirectionalIterator __middle,952 行未改动全部展开* elements in a range.* @ingroup sorting_algorithms* @param __first Start of range.* @param __last End of range.* @return make_pair(m, M), where m is the first iterator i in* [__first, __last) such that no other element in the range is* smaller, and where M is the last iterator i in [__first, __last)* such that no other element in the range is larger.*/17 行未改动* @ingroup sorting_algorithms* @param __first Start of range.* @param __last End of range.* @param __comp Comparison functor.* @return make_pair(m, M), where m is the first iterator i in* [__first, __last) such that no other element in the range is* smaller, and where M is the last iterator i in [__first, __last)* such that no other element in the range is larger.*/75 行未改动{if (__scan != std::__find_if(__first1, __scan,__gnu_cxx::__ops::__iter_comp_iter(__pred, __scan)))continue; // We've seen this one before.auto __matches= std::__count_if(__first2, __last2,__gnu_cxx::__ops::__iter_comp_iter(__pred, __scan));if (0 == __matches ||12 行未改动* @param __first1 Start of first range.* @param __last1 End of first range.* @param __first2 Start of second range.* @return true if there exists a permutation of the elements in the range* [__first2, __first2 + (__last1 - __first1)), beginning with* ForwardIterator2 begin, such that equal(__first1, __last1, begin)* returns true; otherwise, returns false.*/template<typename _ForwardIterator1, typename _ForwardIterator2>816 行未改动全部展开* copied is unchanged.** _GLIBCXX_RESOLVE_LIB_DEFECTS* DR 241. Does unique_copy() require CopyConstructible and Assignable?** _GLIBCXX_RESOLVE_LIB_DEFECTS* DR 538. 241 again: Does unique_copy() require CopyConstructible and* Assignable?*/template<typename _InputIterator, typename _OutputIterator>inline _OutputIterator312 行未改动全部展开* @param __last Another iterator.* @return Nothing.** Sorts the elements in the range @p [__first,__last) in ascending order,* such that for each iterator @e i in the range @p [__first,__last-1),* *(i+1)<*i is false.** The relative ordering of equivalent elements is not preserved, use* @p stable_sort() if this is needed.102 行未改动全部展开__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,typename iterator_traits<_InputIterator2>::value_type>)__glibcxx_function_requires(_LessThanOpConcept<typename iterator_traits<_InputIterator2>::value_type,typename iterator_traits<_InputIterator1>::value_type>)__glibcxx_requires_sorted_set(__first1, __last1, __first2);__glibcxx_requires_sorted_set(__first2, __last2, __first1);return _GLIBCXX_STD_A::__merge(__first1, __last1,433 行未改动全部展开typename iterator_traits<_InputIterator1>::value_type,typename iterator_traits<_InputIterator2>::value_type>)__glibcxx_function_requires(_LessThanOpConcept<typename iterator_traits<_InputIterator2>::value_type,typename iterator_traits<_InputIterator1>::value_type>)__glibcxx_requires_sorted_set(__first1, __last1, __first2);__glibcxx_requires_sorted_set(__first2, __last2, __first1);return _GLIBCXX_STD_A::__set_difference(__first1, __last1,77 行未改动{++__first1;++__first2;}return std::copy(__first2, __last2,std::copy(__first1, __last1, __result));}/**31 行未改动typename iterator_traits<_InputIterator1>::value_type,typename iterator_traits<_InputIterator2>::value_type>)__glibcxx_function_requires(_LessThanOpConcept<typename iterator_traits<_InputIterator2>::value_type,typename iterator_traits<_InputIterator1>::value_type>)__glibcxx_requires_sorted_set(__first1, __last1, __first2);__glibcxx_requires_sorted_set(__first2, __last2, __first1);return _GLIBCXX_STD_A::__set_symmetric_difference(__first1, __last1,176 行未改动全部展开