题目链接:http://codeforces.com/gym/101911/problem/C 问题简述:给定n个细胞以及每个细胞的大小,相同的细胞能进行融合,如果能融合到只剩1个细胞则输出需要额外增加多少细胞才能把全部融合到只剩一个细胞,如果不能则输出-1. 问题分析:每融合一次都要排序,所以用优先队列. /* */ # include <iostream> # include <stdio.h> # include <string.h> # include <…
http://codeforces.com/gym/101911/problem/A Recently Monocarp got a job. His working day lasts exactly m minutes. During work, Monocarp wants to drink coffee at certain moments: there are n minutes a1,a2,…,an , when he is able and willing to take a co…
http://codeforces.com/gym/101911/problem/C Recently Monocarp has created his own mini-laboratory! The laboratory contains n bacteria. Monocarp knows that he can merge any two bacteria having equal sizes, and the resulting bacterium will have the size…
题:https://codeforces.com/gym/101911/problem/A 题意:每天工作m分钟,每次喝coffee得间隔d分钟,然后给出n个数,每个数表示想在一天中的a[i]的时刻喝coffe,问最少喝完的天数 分析:先对数组升序排,若满足间隔的d就向前一个建立联系: #include<bits/stdc++.h> using namespace std; ; int ans[M],head[M]; pair<int,int >a[M]; int main(){…
Gym 101047M Removing coins in Kem Kadrãn Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Practice Description standard input/output Andréh and his friend Andréas are board-game aficionados. They know many of their friend…
Gym 101047K Training with Phuket's larvae Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Practice Description standard input/output Thai cuisine is known for combining seasonings so that every dish has flavors that are…
Gym 101047E Escape from Ayutthaya Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Practice Description standard input/output Ayutthaya was one of the first kingdoms in Thailand, spanning since its foundation in 1350 to…