2022.11.21

关于考试YCC的心路历程……

关机代码!

好,太好了!

年轻人不讲武德!

$ $

气死了,气死了!

2小时,写加调,发现样例的负号是中文符号。

气死了, 气死了!

不过大样例。时间很危险了,走人了。

$ $

我是SB!!啊啊啊啊啊~~~~

\(m\) 用成 \(n\), 继续调!

SB++,把文件名写错跑不出大样例,继续调!

$ $

T1 看不出来什么门道。

没过大样例!

摆,不管它!

YCC 学的东西都忘没了!

大样例真是个神奇的东西,没有大样例慌,有了大样例,过不去也慌,还得调代码,不能摆的理直气壮。

不离

其实不是很明白这个 T1。

懂了!

如果只有速度这一限制,那么就是按速度排序的贪心。可求出 ans1。

加上韧性这一限制后,要保证在速度不变的条件下,韧性最小。

按照以速度为关键字的排序,模拟试穿装备的过程。

当前的速度就是利用贪心求出来的速度。

如果当前速度不增加,就可以穿上此装备,就将此装备丢入一个以韧性为第一关键字的堆中。(目的是保持初始速度不变,初始耐力最小

如果当前速度需要增加才能穿上当前装备,就从堆中取出韧性要求最低,而速度增加值最大的装备穿上。

直到所有的装备都进一次队,在对还在堆中的装备,取出韧性要求最低,而韧性增加值最大的装备穿上。

/*
Date:
Source:
knowledge:
*/
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <queue> 
#define orz cout << "AK IOI" << "\n";+
#define int long long

using namespace std;
const int maxn = 1e5 + 10;

inline int read()
{
	int x = 0, f = 1;  char ch = getchar();
	while(ch > '9' || ch < '0') {if(ch == '-') f = -1; ch = getchar();}
	while(ch <= '9' && ch >= '0') {x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar();}
	return x * f;
}
inline void print(int X)
{
	if(X < 0) X = ~(X - 1), putchar('-');
	if(X > 9) print(X / 10);
	putchar(X % 10 ^ '0');
	return ;
}
inline int Max(int a, int b){
	return a > b ? a : b;
}
inline int Min(int a, int b){
	return a < b ? a : b;
}
int T, n;
struct node{
	int a, b, c, d;	
	bool operator < (const node &x)const
	{
		return b ^ x.b ? b > x.b : d ^ x.d ? d < x.d : a ^ x.a ? a > x.a : c < x.c;
	}
}s[maxn];
bool cmp1(node x, node y)
{
	return x.a ^ y.a ? x.a < y.a : x.c ^ y.c ? x.c > y.c : x.b ^ y.b ? x.b < y.b : x.d > y.d;
}
priority_queue<node> q;
signed main()
{
	//freopen("pineapple.in", "r", stdin);  
	//freopen("pineapple.out", "w", stdout);
	T = read();
	while(T--)
	{
		n = read();  
		for(int i = 1; i <= n; i++)
			s[i].a = read(), s[i].b = read(), s[i].c = read(), s[i].d = read();
		sort(s + 1, s + n + 1, cmp1);
		int ans1 = 0, ans2 = 0, now1 = 0, now2 = 0; 
		for(int i = 1; i <= n; i++)
		{
			if(now1 < s[i].a) ans1 += s[i].a - now1, now1 = s[i].a;
			now1 += s[i].c;
		}
		printf("%lld ", ans1);
		for(int i = 1; i <= n; i++)
		{
			while(s[i].a > ans1) 
			{
				if(now2 < q.top().b) ans2 += q.top().b - now2, now2 = q.top().b;
				now2 += q.top().d, ans1 += q.top().c, q.pop();
			}
			if(s[i].a <= ans1) q.push(s[i]);
		}
		while(!q.empty()) 
		{
			if(now2 < q.top().b) ans2 += q.top().b - now2, now2 = q.top().b;
			now2 += q.top().d, q.pop();
		}
		print(ans2); puts(" ");
	}
	//fclose(stdin);
	//fclose(stdout);
	return 0;
}

二维弹球

dp。

15 pts。

/*
Date:
Source:
knowledge: f[i][j]进行i次传球,目前在j的方案数 
*/
#include <cstdio>
#include <iostream>
#define orz cout << "AK IOI" << "\n";

using namespace std;
const int Mod = 998244353;

inline int read()
{
	int x = 0, f = 1;  char ch = getchar();
	while(ch > '9' || ch < '0') {if(ch == '-') f = -1; ch = getchar();}
	while(ch <= '9' && ch >= '0') {x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar();}
	return x * f;
}
inline void print(int X)
{
	if(X < 0) X = ~(X - 1), putchar('-');
	if(X > 9) print(X / 10);
	putchar(X % 10 ^ '0');
	return ;
}
inline int Max(int a, int b){
	return a > b ? a : b;
}
inline int Min(int a, int b){
	return a < b ? a : b;
}
int n, k, m, f[210][510], dis[510][510]; 
int main()
{
	//freopen("pinball.in", "r", stdin); 
	//freopen("binball.out", "w", stdout);
	n = read(); k = read(); m = read();
	f[0][1] = 1;
	for(int i = 1; i <= m; ++i) 
	{
		int x = read(), y = read();
		dis[x][y] = 1;
	}
	for(int i = 1; i <= n; ++i) dis[i][i] = 1;
	for(int i = 1; i <= k - 1; ++i)
		for (int j = 1; j <= n; ++j)
			for (int l = 1; l <= n; ++l)
				if (!dis[l][j])
					f[i][j] = (f[i][j] + f[i - 1][l]) % Mod;
	for(int i = 1; i <= n; ++i)
		if(!dis[i][1]) f[k][1] = (f[k][1] + f[k - 1][i]) % Mod;
	print(f[k][1]);
	//fclose(stdin);
	//fclose(stdout);
	return 0;
}

方格写数

60pts

/*
Date:
Source:
knowledge:! 有结论吧 ! 
*/
#include <cstdio>
#include <iostream>
#define orz cout << "AK IOI" << "\n";
#define int long long 

using namespace std;

inline int read()
{
    int x = 0, f = 1;  char ch = getchar();
    while(ch > '9' || ch < '0') {if(ch == '-') f = -1; ch = getchar();}
    while(ch <= '9' && ch >= '0') {x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar();}
    return x * f;
}
inline void print(int X)
{
    if(X < 0) X = ~(X - 1), putchar('-');
    if(X > 9) print(X / 10);
    putchar(X % 10 ^ '0');
    return ;
}
inline int Max(int a, int b){
    return a > b ? a : b;
}
inline int Min(int a, int b){
    return a < b ? a : b;
}
int n, m, k, x[2010], y[2010];
int get(int x)
{
    if(x % m == 0) return x / m;
    if(x % m != 0) return x / m + 1;
}
signed main()
{
    //freopen("grid.in", "r", stdin);
    //freopen("grid.out", "w", stdout);
    n = read(), m = read(), k = read(); 
    for(int i = 1; i <= k; i++) 
    {
        x[i] = read(), y[i] = read();
        if(x[i] > n * m || y[i] > n * m) 
        {
            puts("He drank too much!");
            return 0;
        }
    }
    int num = 0, ans;
    for(int i = 1; i <= m; i++)
    {
        int flag = 0;
        for(int j = 1; j <= k; j++)
        {
            int lin1 = get(x[j] + i - 1), lin2 = get(y[j] + i - 1);
            if(lin1 != lin2) {flag = 1; break;}
        }
        if(flag == 0) num++, ans = i;
    }
    if(num == 0) puts("He drank too much!");
    else if(num > 1) puts("He drank a lot!");
    else print(ans);
    //fclose(stdin);
    //fclose(stdout);
    return 0;
}

cym喝啤酒

有暴力分的。

posted @ 2022-11-21 22:25  _程门立雪  阅读(29)  评论(0编辑  收藏  举报