☆☆暑期嗨补一(7.14)

A - A CodeForces - 1257B

Recently Petya walked in the forest and found a magic stick.

Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer:

If the chosen number a is even, then the spell will turn it into 3a2;
If the chosen number a is greater than one, then the spell will turn it into a−1.
Note that if the number is even and greater than one, then Petya can choose which spell to apply.

Petya now has only one number x. He wants to know if his favorite number y can be obtained from x using the spells he knows. The spells can be used any number of times in any order. It is not required to use spells, Petya can leave x as it is.

Input
The first line contains single integer T (1≤T≤104) — the number of test cases. Each test case consists of two lines.

The first line of each test case contains two integers x and y (1≤x,y≤109) — the current number and the number that Petya wants to get.

Output
For the i-th test case print the answer on it — YES if Petya can get the number y from the number x using known spells, and NO otherwise.

You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).

Example
Input
7
2 3
1 1
3 6
6 8
1 2
4 1
31235 6578234
Output
YES
YES
NO
YES
NO
YES
YES
题意:两个数x,y;能不能把x变成y。有两种操作方式
1.如果 a是偶数可以变成 3a/2;
2.a变成 a-1;
思路:你看题就知道了,一个大的数一定能变成一个小的数。然后你再去分析,如果x<y 应该满足啥条件才能变成y ,你可以发现很多的书都是可以 变大的 但是 小于等于3 就不行,3的时候 他没法增大 ,所以 x<=3 一定是不行的,大于就可以。还有一种可以行的是直接就能变成的。

#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<string>
#include<iomanip>
#include<vector>
#include<queue>
#include<algorithm>
using namespace std;
typedef long long ll;
int main()
{
	int t; cin >> t;
	while (t--)
	{
		int x, y; cin >> x >> y;
		if (x >= y||x>3)
		{
			cout << "YES" << endl;
		}
		else if(x * 3 / 2 ==y&&x%2==0)
			cout << "YES" << endl;
		else 
			cout << "NO" << endl;
		
	}

}

B - B CodeForces - 1256B

You are given a permutation of length n. Recall that the permutation is an array consisting of n distinct integers from 1 to n in arbitrary order. For example, [2,3,1,5,4] is a permutation, but [1,2,2] is not a permutation (2 appears twice in the array) and [1,3,4] is also not a permutation (n=3 but there is 4 in the array).

You can perform at most n−1 operations with the given permutation (it is possible that you don’t perform any operations at all). The i-th operation allows you to swap elements of the given permutation on positions i and i+1. Each operation can be performed at most once. The operations can be performed in arbitrary order.

Your task is to find the lexicographically minimum possible permutation obtained by performing some of the given operations in some order.

You can see the definition of the lexicographical order in the notes section.

You have to answer q independent test cases.

For example, let’s consider the permutation [5,4,1,3,2]. The minimum possible permutation we can obtain is [1,5,2,4,3] and we can do it in the following way:

perform the second operation (swap the second and the third elements) and obtain the permutation [5,1,4,3,2];
perform the fourth operation (swap the fourth and the fifth elements) and obtain the permutation [5,1,4,2,3];
perform the third operation (swap the third and the fourth elements) and obtain the permutation [5,1,2,4,3].
perform the first operation (swap the first and the second elements) and obtain the permutation [1,5,2,4,3];
Another example is [1,2,4,3]. The minimum possible permutation we can obtain is [1,2,3,4] by performing the third operation (swap the third and the fourth elements).

Input
The first line of the input contains one integer q (1≤q≤100) — the number of test cases. Then q test cases follow.

The first line of the test case contains one integer n (1≤n≤100) — the number of elements in the permutation.

The second line of the test case contains n distinct integers from 1 to n — the given permutation.

Output
For each test case, print the answer on it — the lexicograhically minimum possible permutation obtained by performing some of the given operations in some order.

Example
Input
4
5
5 4 1 3 2
4
1 2 4 3
1
1
4
4 3 2 1
Output
1 5 2 4 3
1 2 3 4
1
1 4 3 2
Note
Recall that the permutation p of length n is lexicographically less than the permutation q of length n if there is such index i≤n that for all j from 1 to i−1 the condition pj=qj is satisfied, and pi<qi. For example:

p=[1,3,5,2,4] is less than q=[1,3,5,4,2] (such i=4 exists, that pi<qi and for each j<i holds pj=qj),
p=[1,2] is less than q=[2,1] (such i=1 exists, that pi<qi and for each j<i holds pj=qj).
原题欸。。。
题意:一串数交换位置,每个位置只能交换一次,问你最小的串的形式
思路:就是按顺序试就行!

#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<string>
#include<iomanip>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
int main()
{
    int t; cin >> t;
    while (t--)
    {
        int n, a[10000], book[10000];
        memset(book, 0, sizeof book);
        cin >> n;
        for (int i = 1; i <= n; i++)
            cin >> a[i];
        int num = n - 1, k = 1;
        while (k <= n && num > 0)
        {
            for (int i = 1; i <= n; i++)
            {
                if (a[i] == k)
                {
                    for (int j = i - 1; j >= k; j--)
                    {
                        if (book[j] != 0)
                            continue;
                        if (a[j] < a[j + 1])
                            break;
                        swap(a[j], a[j + 1]);
                        book[j] = 1; num--;
                    }
                    k++; break;
                }
            }
        }
        for (int i = 1; i <= n; i++)
            cout << a[i] << " "; cout << endl;
    }


}

C - C CodeForces - 1272B

Recently you have bought a snow walking robot and brought it home. Suppose your home is a cell (0,0) on an infinite grid.

You also have the sequence of instructions of this robot. It is written as the string s consisting of characters ‘L’, ‘R’, ‘U’ and ‘D’. If the robot is in the cell (x,y) right now, he can move to one of the adjacent cells (depending on the current instruction).

If the current instruction is ‘L’, then the robot can move to the left to (x−1,y);
if the current instruction is ‘R’, then the robot can move to the right to (x+1,y);
if the current instruction is ‘U’, then the robot can move to the top to (x,y+1);
if the current instruction is ‘D’, then the robot can move to the bottom to (x,y−1).
You’ve noticed the warning on the last page of the manual: if the robot visits some cell (except (0,0)) twice then it breaks.

So the sequence of instructions is valid if the robot starts in the cell (0,0), performs the given instructions, visits no cell other than (0,0) two or more times and ends the path in the cell (0,0). Also cell (0,0) should be visited at most two times: at the beginning and at the end (if the path is empty then it is visited only once). For example, the following sequences of instructions are considered valid: “UD”, “RL”, “UUURULLDDDDLDDRRUU”, and the following are considered invalid: “U” (the endpoint is not (0,0)) and “UUDD” (the cell (0,1) is visited twice).

The initial sequence of instructions, however, might be not valid. You don’t want your robot to break so you decided to reprogram it in the following way: you will remove some (possibly, all or none) instructions from the initial sequence of instructions, then rearrange the remaining instructions as you wish and turn on your robot to move.

Your task is to remove as few instructions from the initial sequence as possible and rearrange the remaining ones so that the sequence is valid. Report the valid sequence of the maximum length you can obtain.

Note that you can choose any order of remaining instructions (you don’t need to minimize the number of swaps or any other similar metric).

You have to answer q independent test cases.

Input
The first line of the input contains one integer q (1≤q≤2⋅104) — the number of test cases.

The next q lines contain test cases. The i-th test case is given as the string s consisting of at least 1 and no more than 105 characters ‘L’, ‘R’, ‘U’ and ‘D’ — the initial sequence of instructions.

It is guaranteed that the sum of |s| (where |s| is the length of s) does not exceed 105 over all test cases (∑|s|≤105).

Output
For each test case print the answer on it. In the first line print the maximum number of remaining instructions. In the second line print the valid sequence of remaining instructions t the robot has to perform. The moves are performed from left to right in the order of the printed sequence. If there are several answers, you can print any. If the answer is 0, you are allowed to print an empty line (but you can don’t print it).

Example
Input
6
LRU
DURLDRUDRULRDURDDL
LRUDDLRUDRUL
LLLLRRRR
URDUR
LLL
Output
2
LR
14
RUURDDDDLLLUUR
12
ULDDDRRRUULL
2
LR
2
UD
0

Note
There are only two possible answers in the first test case: “LR” and “RL”.

The picture corresponding to the second test case:
在这里插入图片描述 Note that the direction of traverse does not matter
Another correct answer to the third test case: “URDDLLLUURDR”.
题意:走格子 不能走重复的地方(除了(0,0)),给你一串指令 问你 在满足题意得情况下他的最长长度的指令,你可以随便修改,删除 交换之类的!
思路:既然是随便移动,那你就直接 走个矩形不就得了,你去算上下 指令数 左右指令数,然后再走就行了,但是如果 上下指令有一个为零 那么只能输出 左右,如果 都有为0的 那么就输出0 就行啦!

#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<string>
#include<iomanip>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
int main()
{
    int t; cin >> t;
    while (t--)
    {
        char s[100005];
        cin >> s;
        int n = strlen(s);
        int u = 0, d = 0, l = 0, r = 0;
        for (int i = 0; i < n; i++)
        {
            if (s[i] == 'U') u++;
            if (s[i] == 'D')d++;
            if (s[i] == 'L') l++;
            if (s[i] == 'R')r++;
        }
        if (l == 0 || r == 0)
        {
            if (u == 0 || d == 0)
                cout << 0 << endl;
            else
            {
                cout << 2 << endl;
                cout << "UD" << endl;
            }
        }
        else if (u == 0 || d == 0)
        {
            if (l == 0 || r == 0)
                cout << 0 << endl;
            else
            {
                cout << 2 << endl;
                cout << "LR" << endl;
            }
        }
        else
        {
            int x = min(l, r); int y = min(u, d);
            cout << (x + y) * 2 << endl;
            for (int i = 1; i <= x; i++)
                cout << "L";
            for (int i = 1; i <= y; i++)
                cout << "U";
            for (int i = 1; i <= x; i++)
                cout << "R";
            for (int i = 1; i <= y; i++)
                cout << "D";
            cout << endl;
        }
    }


}

***************************************

D - D CodeForces - 1257D

You play a computer game. In this game, you lead a party of m heroes, and you have to clear a dungeon with n monsters. Each monster is characterized by its power ai. Each hero is characterized by his power pi and endurance si.

The heroes clear the dungeon day by day. In the beginning of each day, you choose a hero (exactly one) who is going to enter the dungeon this day.

When the hero enters the dungeon, he is challenged by the first monster which was not defeated during the previous days (so, if the heroes have already defeated k monsters, the hero fights with the monster k+1). When the hero fights the monster, there are two possible outcomes:

if the monster’s power is strictly greater than the hero’s power, the hero retreats from the dungeon. The current day ends;
otherwise, the monster is defeated.
After defeating a monster, the hero either continues fighting with the next monster or leaves the dungeon. He leaves the dungeon either if he has already defeated the number of monsters equal to his endurance during this day (so, the i-th hero cannot defeat more than si monsters during each day), or if all monsters are defeated — otherwise, he fights with the next monster. When the hero leaves the dungeon, the current day ends.

Your goal is to defeat the last monster. What is the minimum number of days that you need to achieve your goal? Each day you have to use exactly one hero; it is possible that some heroes don’t fight the monsters at all. Each hero can be used arbitrary number of times.

Input
The first line contains one integer t (1≤t≤105) — the number of test cases. Then the test cases follow.

The first line of each test case contains one integer n (1≤n≤2⋅105) — the number of monsters in the dungeon.

The second line contains n integers a1, a2, …, an (1≤ai≤109), where ai is the power of the i-th monster.

The third line contains one integer m (1≤m≤2⋅105) — the number of heroes in your party.

Then m lines follow, each describing a hero. Each line contains two integers pi and si (1≤pi≤109, 1≤si≤n) — the power and the endurance of the i-th hero.

It is guaranteed that the sum of n+m over all test cases does not exceed 2⋅105.

Output
For each test case print one integer — the minimum number of days you have to spend to defeat all of the monsters (or −1 if it is impossible).

Example
Input
2
6
2 3 11 14 1 8
2
3 2
100 1
5
3 5 100 2 3
2
30 5
90 1
Output
5
-1
题意:有n个怪物,每个怪物都有一个能力值a。有m个勇士,每个勇士都有一个力量P和耐力S。每天可以选择一个勇士去打怪物,必须按顺序打,如果这个勇士的能力P>=a那么就可以打败这个怪物,就必须打下一个怪物,而且最多一天只能打S个怪物。打一个怪物耐力值-1,如果力量P<a或者耐力值为0,这个勇士就得回来。这天结束,每个勇士可以使用无数次。问最少需要多少天,能把所有的怪物全部打败。
思路:利用贪心的思想吧,找个数组来储存 耐力为i时的 最大 攻击力 ,每次都争取用耐力大,攻击力大的士兵。

#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<string>
#include<iomanip>
#include<vector>
#include<queue>
#include<algorithm>
using namespace std;
typedef long long ll;
int a[200001], p[200001], s[200001];
int mx[200001];
int main()
{
	int t; cin >> t;
	while (t--)
	{
		int n; cin >> n;
		for (int i =0; i <n; i++)
		{
			cin >> a[i];
			mx[i] = 0;
		}
		mx[n] = 0;
		int m; cin >> m;
		for (int i = 0; i <m; i++)
		{
			cin >> p[i] >> s[i];
			mx[s[i]] = max(mx[s[i]], p[i]);
		}
		for (int i = n - 1; i >= 0; i--)
		{
			mx[i] = max(mx[i], mx[i + 1]);
		}
		int day = 0, pos = 0;
		bool f = true;
		while (pos < n)
		{
			day++;
			int tmp = pos, maxx = 0;
			while (1)
			{
				maxx = max(maxx, a[tmp]);
				if (maxx > mx[tmp - pos + 1])
					break;
				tmp++;
			}
			if (tmp == pos)
			{
				f = false; break;
			}
			pos = tmp;
		}
		if (!f)
			day =-1;
		cout << day << endl;
	}

}

F - F CodeForces - 1272D

You are given an array a consisting of n integers.

You can remove at most one element from this array. Thus, the final length of the array is n−1 or n.

Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.

Recall that the contiguous subarray a with indices from l to r is a[l…r]=al,al+1,…,ar. The subarray a[l…r] is called strictly increasing if al<al+1<⋯<ar.

Input
The first line of the input contains one integer n (2≤n≤2⋅105) — the number of elements in a.

The second line of the input contains n integers a1,a2,…,an (1≤ai≤109), where ai is the i-th element of a.

Output
Print one integer — the maximum possible length of the strictly increasing contiguous subarray of the array a after removing at most one element.

Examples
Input
5
1 2 5 3 4
Output
4
Input
2
1 2
Output
2
Input
7
6 5 4 3 2 4 3
Output
2
Note
In the first example, you can delete a3=5. Then the resulting array will be equal to [1,2,3,4] and the length of its largest increasing subarray will be equal to 4.
题意:就是你可以删除一个或者不删除,使得 它有最长递增字段,求长度。
思路:其实可以建两个数组 分别从前到后递增 和从后到前递减 两个数组来储存长度,因为你删除了一个数字之后 他相当于就是起点!
然后你就试试删除那个数 可以使得递增段最长!

#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<string>
#include<iomanip>
#include<vector>
#include<queue>
#include<algorithm>
using namespace std;
typedef long long ll;
int a[200001]; int b[200001], c[200010];
int main()
{
	int n;
	cin >> n;
	
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i];
		b[i] = 1;
		c[i] =1;
	}
	int maxx = 1;
	for (int i =2; i <= n; i++)
	{
		if (a[i-1]<a[i])
			b[i] = b[i-1] + 1;
		maxx = max(maxx, b[i]);
	}
	for (int i = n - 1; i >= 1; i--)
	{
		if (a[i] < a[i+1])
			c[i] = c[i+1] + 1;
		maxx = max(maxx, c[i]);
	}

	for (int i = 1; i <=n-2; i++)
	{
		if (a[i] < a[i + 2])
			maxx = max(maxx, c[i + 2] + b[i]);
	}
	cout << maxx << endl;
}

G - G CodeForces - 1249D2

▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
The only difference between easy and hard versions is constraints.

You are given n segments on the coordinate axis OX. Segments can intersect, lie inside each other and even coincide. The i-th segment is [li;ri] (li≤ri) and it covers all integer points j such that li≤j≤ri.

The integer point is called bad if it is covered by strictly more than k segments.

Your task is to remove the minimum number of segments so that there are no bad points at all.

Input
The first line of the input contains two integers n and k (1≤k≤n≤2⋅105) — the number of segments and the maximum number of segments by which each integer point can be covered.

The next n lines contain segments. The i-th line contains two integers li and ri (1≤li≤ri≤2⋅105) — the endpoints of the i-th segment.

Output
In the first line print one integer m (0≤m≤n) — the minimum number of segments you need to remove so that there are no bad points.

In the second line print m distinct integers p1,p2,…,pm (1≤pi≤n) — indices of segments you remove in any order. If there are multiple answers, you can print any of them.

Examples
Input
7 2
11 11
9 11
7 8
8 9
7 8
9 11
7 9
Output
3
4 6 7
Input
5 1
29 30
30 30
29 29
28 30
30 30
Output
3
1 4 5
Input
6 1
2 3
3 3
2 3
2 2
2 3
2 3
Output
4
1 3 5 6
题意:在x轴上有几条线段,如果某个点是被k个线段覆盖,那么这个点是坏点,求删除尽可能少的线段从而减少坏点最多!
思路:直接贪心即可,从前往后找发现每个点大于k那么就删掉覆盖该点所有线段上的结束点最靠后的的线段即可。

这个思路看着简单 但是写起来代码一点不容易啊!!!!!
这个代码是看的他人的自己 的没ac

#include<iostream>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<iomanip>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<vector>
#define ll long long;
using namespace std;
const int N = 2e5 + 10;
int n, k;
struct Node
{
	int y;
	int idx;
};
bool operator<(Node a, Node b)//排序
{
	if (a.y != b.y)
		return a.y < b.y;
	return a.idx < b.idx;
}
vector<Node> g[N];
vector<int> ans;
int main()
{
	int x, y;
	cin >> n >> k;
	for (int i = 1; i <= n; i++)
	{
		Node p;
		cin >> x >> y;
		p.y = y;
		p.idx = i;
		g[x].push_back(p);
	}
	set<Node> s;
	for (int i = 1; i < N; i++)
	{
		while (s.size() && (*s.begin()).y < i)//没有被覆盖的区间删除
			s.erase(*s.begin());

		for (int j = 0; j < g[i].size(); j++)//存入可覆盖区间
			s.insert(g[i][j]);

		while (s.size() > k)//判断该点被覆盖次数是否超过 k
		{
			ans.push_back((*s.rbegin()).idx);//删除的区间存下
			s.erase(*s.rbegin());
		}
	}
	cout << ans.size() << endl;;
	int len = ans.size();
	for (int i = 0; i < len; i++)
	{
		printf("%d%c", ans[i], i == len - 1 ? '\n' : ' ');
	}
	return 0;
}

☀●●◆■▅▆▇☀●●◆■▅▆▇☀●●◆■▅▆▇☀●●◆■▅▆▇☀●●◆■▅▆▇☀●●◆■▅▆▇☀●●◆■▅▆▇

E - E CodeForces - 1260D ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓

You are playing a computer game, where you lead a party of m soldiers. Each soldier is characterised by his agility ai.

The level you are trying to get through can be represented as a straight line segment from point 0 (where you and your squad is initially located) to point n+1 (where the boss is located).

The level is filled with k traps. Each trap is represented by three numbers li, ri and di. li is the location of the trap, and di is the danger level of the trap: whenever a soldier with agility lower than di steps on a trap (that is, moves to the point li), he gets instantly killed. Fortunately, you can disarm traps: if you move to the point ri, you disarm this trap, and it no longer poses any danger to your soldiers. Traps don’t affect you, only your soldiers.

You have t seconds to complete the level — that is, to bring some soldiers from your squad to the boss. Before the level starts, you choose which soldiers will be coming with you, and which soldiers won’t be. After that, you have to bring all of the chosen soldiers to the boss. To do so, you may perform the following actions:

if your location is x, you may move to x+1 or x−1. This action consumes one second;
if your location is x and the location of your squad is x, you may move to x+1 or to x−1 with your squad in one second. You may not perform this action if it puts some soldier in danger (i. e. the point your squad is moving into contains a non-disarmed trap with di greater than agility of some soldier from the squad). This action consumes one second;
if your location is x and there is a trap i with ri=x, you may disarm this trap. This action is done instantly (it consumes no time).
Note that after each action both your coordinate and the coordinate of your squad should be integers.

You have to choose the maximum number of soldiers such that they all can be brought from the point 0 to the point n+1 (where the boss waits) in no more than t seconds.

Input
The first line contains four integers m, n, k and t (1≤m,n,k,t≤2⋅105, n<t) — the number of soldiers, the number of integer points between the squad and the boss, the number of traps and the maximum number of seconds you may spend to bring the squad to the boss, respectively.

The second line contains m integers a1, a2, …, am (1≤ai≤2⋅105), where ai is the agility of the i-th soldier.

Then k lines follow, containing the descriptions of traps. Each line contains three numbers li, ri and di (1≤li≤ri≤n, 1≤di≤2⋅105) — the location of the trap, the location where the trap can be disarmed, and its danger level, respectively.

Output
Print one integer — the maximum number of soldiers you may choose so that you may bring them all to the boss in no more than t seconds.

Example
Input
5 6 4 14
1 2 3 4 5
1 5 2
1 2 5
2 3 5
3 5 3
Output
3
Note
In the first example you may take soldiers with agility 3, 4 and 5 with you. The course of action is as follows:

go to 2 without your squad;
disarm the trap 2;
go to 3 without your squad;
disartm the trap 3;
go to 0 without your squad;
go to 7 with your squad.
The whole plan can be executed in 13 seconds.
题意:一个长度为n+1的直线上有k个陷阱,每个陷阱描述为{l,r,v},表示这个陷阱的起始点l,终止点r,力量值v,你有m个士兵,每个士兵有一个能力值ai,当ai<vi时表示士兵i不能越过陷阱i,但是你可以走过去,当你经过位置ri时,陷阱i就消失了,初始时你们都在位置0,现在要去位置n+1,你现在必须选择一些士兵,你携带着他们通过所有的障碍到达n+1,且必须在规定的时间t内完成,注意,如果想让士兵移动,你必须和士兵在同一位置,也就是你清除了障碍物ri,你必须回到li-1带上你的军队一起出发,问你最后能带的最多的士兵的数量。

#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <stack>
#include <map>
#include <queue>
#include <vector>
#include <set>
#include <algorithm>
#include <iomanip>
#define LL long long
using namespace std;
const int N = 2e5 + 5;
struct Node
{
	int l, r, d;
}s[N];
int n, m, k, t;
int a[N], cnt[N];	//cnt[]即为排雷的路程区间
bool check(int mid)
{
	memset(cnt, 0, sizeof cnt);
	for (int i = 1; i <= k; i++)	//利用差分,给[l,r]都加1
		if (a[mid] < s[i].d)
		{
			cnt[s[i].l]++, cnt[s[i].r + 1]--;
		}
	for (int i = 1; i <= n + 1; i++)		//前缀和还原
		cnt[i] += cnt[i - 1];
	int sum = 0;
	for (int i = 1; i <= n + 1; i++)		//记录区间长度
		if (cnt[i]) sum++;
	return 2 * sum + n + 1 <= t;
}
int main()
{
	cin >> m >> n >> k >> t;
	for (int i = 1; i <= m; i++)
		cin>>a[i];
	for (int i = 1; i <= k; i++)
		cin >> s[i].l >> s[i].r >> s[i].d;
	sort(a + 1, a + 1 + m, greater<int>());	//按从大到小进行排序
	int l = 0, r = m;
	while (r > l)	//二分过程
	{
		int mid = l + r + 1 >> 1;
		if (check(mid)) l = mid;
		else r = mid - 1;
	}
	cout << l << endl;
}

反思:

今天做的好差,首先是 最后这俩E G 这两个题自己都是没搞明白,这部分 大部分都是 贪心的,确实,自己 这部分既然没做好就是贪心没掌握到家!还有一些容器的用法,自己也想不到,明天继续加油吧!!!!!我会再去研究研究的!

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
4S店客户管理小程序-毕业设计,基于微信小程序+SSM+MySql开发,源码+数据库+论文答辩+毕业论文+视频演示 社会的发展和科学技术的进步,互联网技术越来越受欢迎。手机也逐渐受到广大人民群众的喜爱,也逐渐进入了每个用户的使用。手机具有便利性,速度快,效率高,成本低等优点。 因此,构建符合自己要求的操作系统是非常有意义的。 本文从管理员、用户的功能要求出发,4S店客户管理系统中的功能模块主要是实现管理员服务端;首页、个人中心、用户管理、门店管理、车展管理、汽车品牌管理、新闻头条管理、预约试驾管理、我的收藏管理、系统管理,用户客户端:首页、车展、新闻头条、我的。门店客户端:首页、车展、新闻头条、我的经过认真细致的研究,精心准备和规划,最后测试成功,系统可以正常使用。分析功能调整与4S店客户管理系统实现的实际需求相结合,讨论了微信开发者技术与后台结合java语言和MySQL数据库开发4S店客户管理系统的使用。 关键字:4S店客户管理系统小程序 微信开发者 Java技术 MySQL数据库 软件的功能: 1、开发实现4S店客户管理系统的整个系统程序; 2、管理员服务端;首页、个人中心、用户管理、门店管理、车展管理、汽车品牌管理、新闻头条管理、预约试驾管理、我的收藏管理、系统管理等。 3、用户客户端:首页、车展、新闻头条、我的 4、门店客户端:首页、车展、新闻头条、我的等相应操作; 5、基础数据管理:实现系统基本信息的添加、修改及删除等操作,并且根据需求进行交流信息的查看及回复相应操作。
现代经济快节奏发展以及不断完善升级的信息化技术,让传统数据信息的管理升级为软件存储,归纳,集中处理数据信息的管理方式。本微信小程序医院挂号预约系统就是在这样的大环境下诞生,其可以帮助管理者在短时间内处理完毕庞大的数据信息,使用这种软件工具可以帮助管理人员提高事务处理效率,达到事半功倍的效果。此微信小程序医院挂号预约系统利用当下成熟完善的SSM框架,使用跨平台的可开发大型商业网站的Java语言,以及最受欢迎的RDBMS应用软件之一的MySQL数据库进行程序开发。微信小程序医院挂号预约系统有管理员,用户两个角色。管理员功能有个人中心,用户管理,医生信息管理,医院信息管理,科室信息管理,预约信息管理,预约取消管理,留言板,系统管理。微信小程序用户可以注册登录,查看医院信息,查看医生信息,查看公告资讯,在科室信息里面进行预约,也可以取消预约。微信小程序医院挂号预约系统的开发根据操作人员需要设计的界面简洁美观,在功能模块布局上跟同类型网站保持一致,程序在实现基本要求功能时,也为数据信息面临的安全问题提供了一些实用的解决方案。可以说该程序在帮助管理者高效率地处理工作事务的同时,也实现了数据信息的整体化,规范化与自动化。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值