摘要:
Unusual Matrix You are given two binary square matrices a and b of size n×n. A matrix is called binary if each of its elements is equal to 0 or 1. You 阅读全文
摘要:
C. Three Bags You are given three bags. Each bag contains a non-empty multiset of numbers. You can perform a number of operations on these bags. In on 阅读全文
摘要:
链接 来源:牛客网 题目描述 Cg特别喜欢翻转序列! 跨年夜也要继续翻转! 现在有一个长度为n的序列s,Cg将其翻转之后变成了t。 路过的oxy发现了这个t序列,但是oxy不可以直接将序列翻转,她只可以执行一种操作: 选择任意的两个数ai和aj(j>i),花费j−i将两数位置交换 问oxy最少花费多 阅读全文
摘要:
D. Ceil Divisions You have an array $a_1,a_2,…,a_n$where ai=i. In one step, you can choose two indices x and y (x≠y) and set \(a_x=\lceil{\frac{a_x}{a 阅读全文
摘要:
A. Regular Bracket Sequence A bracket sequence is called regular if it is possible to obtain correct arithmetic expression by inserting characters + a 阅读全文
摘要:
链接 来源:牛客网 题目描述 牛妹手里捧着 T 个数,但每个数都超级超级大。 牛牛有强迫症,一看到数就想把它分解质因数,并记录下它的质因子指数的最小值。 形式化地,对于数 \(x=p_1^{a_1}p_2^{a_2}...p_k^{a_k} ,(a_1,a_2,...,a_k) > 0\),牛牛会记 阅读全文
摘要:
链接 直线上有n座山峰,第i座的高度为hi。从某座山峰上放飞一架纸飞机,它可以从左往右依次经过一系列高度严格递减的山头。 假设五座山峰的高度依次是3,4,3,2,1。从第一座山峰上放飞的纸飞机可以依次经过第一、四、五座山峰,但不能经过第二、三座山峰。 对于每座山峰,求出要经过除这座山峰外的每座山峰, 阅读全文
摘要:
将树压缩成若干个有用的点 for(int i=0;i<k;++i){ int f=lca(stk[r],h[i]); while(r&&id[f]<id[stk[r-1]]){ g1.add(stk[r-1],stk[r],get(stk[r],stk[r-1])); --r; } if(f^stk 阅读全文
摘要:
CF-E. Messenger Simulator Polycarp is a frequent user of the very popular messenger. He's chatting with his friends all the time. He has n friends, nu 阅读全文
摘要:
D. Domino for Young You are given a Young diagram. Given diagram is a histogram with n columns of lengths \(a_1,a_2,…,a_n (a_1≥a_2≥…≥a_n≥1).\) Young d 阅读全文