暑假集训存录

暑假集训存录

推歌 —— BlackPink 《뚜두뚜두》
착한 얼굴에 그렇지 못한 태도
	
善良的脸蛋 不屑的态度
가녀린 몸매 속 가려진 volume은 두 배로
	
纤细的身体里隐藏着两倍的音量
거침없이 직진 굳이 보진 않지 눈치
	
势不可挡 一直向前 不必察言观色
Black 하면 Pink 우린 예쁘장한 Savage
	
Black Pink是一体 我们靓丽奔放
원할 땐 대놓고 뺏지
	
想要的时候 放手去争就行
넌 뭘 해도 칼로 물 베기
	
无论你做什么 我都会原谅你
두 손엔 가득한 fat check
	
我手握大额支票
궁금하면 해봐 fact check
	
好奇的话 就来查明真相
눈 높인 꼭대기
	
眼望巅峰
물 만난 물고기
	
如鱼得水
좀 독해 난 Toxic
	
我有点狠毒
You 혹해 I'm Foxy
	
我是诱惑你的狐狸
두 번 생각해
	
再好好想想
흔한 남들처럼 착한 척은 못 하니까
	
我可不像一般人那样伪善
착각하지 마
	
你别自欺欺人了
쉽게 웃어주는 건 날 위한 거야
	
那轻松绽放的笑容是为了我自己
아직은 잘 모르겠지
	
现在还弄不明白吧
굳이 원하면 test me
	
若是渴望拥有我 就来一探究竟
넌 불 보듯이 뻔해
	
你的意图一目了然
만만한 걸 원했다면
	
如果你甘愿臣服于我
Oh wait til' I do what I do

Hit you with that ddu-du ddu-du du

Hit you with that ddu-du ddu-du du

지금 내가 걸어가는 거린
	
我正走向
BLACKPINK 4 way 사거리
	
BLACKPINK 4 way 十字路口
동서남북 사방으로 run it
	
向着东南西北 四处奔跑
너네 버킷리스트 싹 다 I bought it
	
你们的愿望清单我来买单
널 당기는 것도 멀리 밀치는 것도
	
对你半推半就
제멋대로 하는 bad girl
	
我是随心所欲的坏女孩
좋건 싫어하건 누가 뭐라 하던
	
不管谁说什么 我都有我的喜好
When the bass drop it's another banger

두 번 생각해
	
再好好想想
흔한 남들처럼 착한 척은 못 하니까
	
我可不像一般人那样伪善
착각하지 마
	
你别自欺欺人了
쉽게 웃어주는 건 날 위한 거야
	
那轻松绽放的笑容是为了我自己
아직은 잘 모르겠지
	
现在还弄不明白吧
굳이 원하면 test me
	
若是渴望拥有我 就来一探究竟
넌 불 보듯이 뻔해
	
你的意图一目了然
만만한 걸 원했다면
	
如果你甘愿臣服于我
Oh wait til' I do what I do
	
Hit you with that ddu-du ddu-du du
	
Hit you with that ddu-du ddu-du du
	
What you gonna do when I comecome through with that that uh uh
	
What you gonna do when I comecome through with that that uh uh
뜨거워 뜨거워 뜨거워 like fire
	
热辣似火 热辣似火
뜨거워 뜨거워 뜨거워 like fire
	
热辣似火 热辣似火
뜨거워 뜨거워 뜨거워 like fire
	
热辣似火 热辣似火
뜨거워 뜨거워 뜨거워 like fire
	
热辣似火 热辣似火
Hit you with that ddu-du ddu-du du

模拟赛

7 -- 树上游戏

\(Description\)

这一天, \(Delov\) 在和他的 \(npy\) 们在树上做游戏,他的 \(npy\) 们喜欢不同的位置,所以每个树节点上都有他的 \(npy\),她们都希望 \(Delov\) 离自己近一些,否则就会不高兴。具体来讲,\(Delov\) 所在节点离某个 \(npy\) 所在节点的树上路径长度即为该节点 \(npy\) 的不满意度。

\(Delov\) 希望能够让所有 \(npy\) 的不满意度的最大值最小,而且,作为时间管理大师, \(Delov\) 拥有分身术,也就是说,他能同时存在于 kk 个节点,对 \(npy\) 来说她们会以离自己最近的\(Delov\)计算不满意度。

\(Delov\) 想知道所有 \(npy\) 的不满意度的最大值的最小值是多少,并把问题抛给你。

\(1 \le k < n < 2 \times 10 ^ 5\)

题解

简单贪心。二分答案一下。

从下往上跳起来,由于还可能是跨子树,所以对于每个子树根,都要跑一遍,由它的儿子记录最远的、未被覆盖的深度。
\(Delov\) 在的,最浅的点。

直接转移即可。看代码:

CODE
#include <bits/stdc++.h>
using namespace std ; 
const int N = 2e5 + 100 ; 
inline int read() {
	int x = 0 , f = 1 ; 
	char c = getchar() ; 
	
	while (c < '0' ||  c > '9') {
		if (c == '-') f = -f ; 
		
		c = getchar() ; 
	}
	
	while (c >= '0' && c <= '9') {
		x = x * 10 + c - '0' ; 
		c = getchar() ; 
	}
	
	return x * f ; 
}

struct EDGE {
	int next , to ; 
} e[N << 1] ; int head[N] , cnt ; 
inline void add(int x , int y) {
	++ cnt , e[cnt].to = y , e[cnt].next = head[x] , head[x] = cnt ; 
}
int n , K , depth[N] , father[N] , Heavy[N] ; 
int num ; int Maxdepth[N] , Coverage[N] ; 

void dfs(int x , int fa , int mid) {
	int P = 0 , Q = -1 , flag = 0 ; 

	for (int i = head[x] ; i ; i = e[i].next) {
		int y = e[i].to ; 
		if (y == fa) continue ; 

		flag = 1 ; 
		dfs(y , x , mid) ; 
		P = max(P , Maxdepth[y] + 1) ; 
		Q = max(Q , Coverage[y] - 1) ; 
	}

	if (!flag) {
		Maxdepth[x] = 0 , Coverage[x] = -1 ; 
		return ; 
	}

	if (P <= Q) {
		Maxdepth[x] = -1 ; Coverage[x] = Q ; 
	} else if (P == mid) {
		++ num ; 
		Maxdepth[x] = -1 ; Coverage[x] = mid ; 
	} else { 
        if (x == 1) ++ num ; 

		Maxdepth[x] = P , Coverage[x] = Q ; 
	}
}

bool check(int mid) {
	num = 0 ; 
	for (int i = 1 ; i <= n ; ++ i) Maxdepth[i] = Coverage[i] = 0 ; 
	dfs(1 , 0 , mid) ; 
	return num <= K ; 
}

signed main() {
	n = read() , K = read() ; 
	for (int i = 1 , x , y ; i < n ; ++ i) {
		x = read() , y = read() ; 
		add(x , y) ; add(y , x) ; 
	}

	int left = 1 , right = n - 1 ; int ans ; 

	while (left <= right) {
		int mid = (left + right) >> 1 ; 

		if (check(mid)) {
			ans = mid ; 
			right = mid - 1 ; 
		} else left = mid + 1 ; 
	}

	cout << ans ; 
}

15 -- T1串串

推歌--《海绵宝宝》
Are you ready kids?
准备好了吗?孩子们?
Aye, aye, captain!
是的,船长
I can't hear you!
太小声罗
Aye, aye, captain!
是的,船长
Ooh
哦~
Who lives in a pineapple under the sea?
是谁住在深海的大菠萝里
SpongeBob SquarePants!
海绵宝宝
Absorbent and yellow and porous is he!
方方黄黄伸缩自如
SpongeBob SquarePants!
海绵宝宝
If nautical nonsense be something you wish!
如果四处探险是你的愿望
SpongeBob SquarePants!
海绵宝宝
Then drop on the deck and flop like a fish!
那就敲敲甲板让大鱼开路
SpongeBob SquarePants!
海绵宝宝
Ready?
准备好了吗?
SpongeBob SquarePants,
海绵宝宝
SpongeBob SquarePants!
海绵宝宝
SpongeBob SquarePants!
海绵宝宝
SpongeBob SquarePants!
海绵宝宝
Ha, ha, ha
哈哈
Ha, ha, ha, ha, ha
哈哈哈 
推歌--BLACKPINK《PinkVnom》
Kick in the door Waving the coco
팝콘이나 챙겨 껴들 생각 말고
I talk that talk Runways I walk walk
눈 감고 pop pop 안 봐도 척
One by one then Two by two
내 손끝 툭 하나에 다 무너지는 중
가짜 쇼 치곤 화려했지
Makes no sense You couldn’t get a dollar outta me
자 오늘 밤이야 난 독을 품은 꽃
네 혼을 빼앗은 다음 Look what you made us do
천천히 널 잠재울 FIRE 잔인할 만큼 아름다워
I bring the pain like
This that pink venom
This that pink venom
This that pink venom
Get ‘em, get ‘em, get ‘em
Straight to ya dome like whoa whoa whoa
Straight to ya dome like ah ah ah
Taste that pink venom
Taste that pink venom
Taste that pink venom
Get ‘em, get ‘em, get ‘em
Straight to ya dome like whoa whoa whoa
Straight to ya dome like ah ah ah
Black paint and ammo, got bodies like Rambo
Rest in peace, please light up a candle
This da life of a vandal, masked up and I’m still in Celine
Designer crimes or it wouldn’t be me
Diamonds shinin’ drive in silence I don’t mind it I’m ridin’
Flyin’ private side by side with da pilot Up in the sky
And I’m wildin’, stylin’ on them and there’s no chance
Cuz we got bodies on bodies like this a slow dance
자 오늘 밤이야 난 독을 품은 꽃
네 혼을 빼앗은 다음 Look what you made us do
천천히 널 잠재울 FIRE 잔인할 만큼 아름다워
I bring the pain like
This that pink venom
This that pink venom
This that pink venom
Get ‘em, get ‘em, get ‘em
Straight to ya dome like whoa whoa whoa
Straight to ya dome like ah ah ah
Taste that pink venom
Taste that pink venom
Taste that pink venom
Get ‘em, get ‘em, get ‘em
Straight to ya dome like whoa whoa whoa
Straight to ya dome like ah ah ah
원한다면 provoke us
감당 못해 and you know this
이미 퍼져버린 shot that potion
네 눈앞은 핑크빛 ocean
Come and give me all the smoke
도 아니면 모 like I’m so rock and roll
Come and give me all the smoke
다 줄 세워 봐 자 STOP DROP
I bring the pain like
La tatata La tatata La tatata La tatata
(JENNIE) La tatata La tatata La tatata La tatata
La tatata La tatata
La tatata La tatata
Straight to ya
Straight to ya
Straight to ya dome like
La tatata La tatata La tatata La tatata
(JENNIE) La tatata La tatata La tatata La tatata
La tatata La tatata
La tatata La tatata
I bring the pain like

简单题其实只是在求回文串而已,以及构成回文串的子串,看代码就懂了

直接 memset 狂挂 40pts

CODE
#include <bits/stdc++.h>
#include <bits/extc++.h>
typedef long long ll ; 
typedef unsigned long long ull ; 
using namespace std ; 
using namespace __gnu_pbds ; 
using namespace __gnu_cxx ; 
const int N = 1e6 + 100 ; 
const int down = 131 ; 
ull does[N] ; 

int n , len ; 
char s[N] ; ull Hash1[N] , Hash2[N] ; 
vector <int> v[N] ; bool vis[N] ; 
vector <int> ans , c ; 

inline bool pd(int x , int y) {
	int mid = (x + y) >> 1 ; 

	if ((y - x + 1) % 2 == 0) {
		return false ; 
	} else {
		return (Hash1[mid] - Hash1[x - 1]) * does[mid - 1] == (Hash2[mid] - Hash2[y + 1]) * does[len - mid] ; 
	}
}

void dfs(int x) {
	vis[x] = 1 ; 
	ans.push_back(x) ; 

	if (pd(1 , x) && !vis[(1 + x) >> 1]) dfs((1 + x) >> 1) ; 
}

signed main() {
	ios :: sync_with_stdio(0) , cin.tie(0) , cout.tie(0) ; 
	cin >> n ; 

	does[0] = 1 ; 
	for (int i = 1 ; i < N ; ++ i) does[i] = does[i - 1] * down ; 

	while (n --) {
		for (int i = 0 ; i <= len ; ++ i) vis[i] = 0 ; 
		c.clear() ; ans.clear() ; 
		cin >> s + 1 ; len = strlen(s + 1) ; 

		for (int i = 1 ; i <= len ; ++ i) Hash1[i] = Hash1[i - 1] + does[len - i] * s[i] ; 
		for (int i = len ; i >= 1 ; -- i) Hash2[i] = Hash2[i + 1] + does[i - 1] * s[i] ; 

		int Next = 0 ; 

		for (int i = len ; i >= 1 ; -- i) {
			if (pd(i , len)) {
				Next = i ; 
				c.push_back((len + i) >> 1) ; 
			}
		}

		for (auto j : c) {
			if (!vis[j]) {
				dfs(j) ; 
			}
		}

		stable_sort(ans.begin() , ans.end()) ; 

		for (auto j : ans) cout << j << ' ' ; cout << '\n' ; 
		ans.clear() ; 
	}
}

T2

回滚莫队

CODE
#include <bits/stdc++.h>
typedef long long ll ; 
typedef unsigned long long ull ; 
using namespace std ; 
const int N = 2e5 + 100 ; 

int n , m , p ; int a[N] , c[N] ; int length ; int belong[N] ; 
int bucket[N] , barrel[N] ; int Answer[N] ; int L[N] , R[N] ; 
struct Node {
	int l , r , Bl , Br , id ; 
} b[N] ; int Ans = 0 ; 

void deleted(int x) {
	bucket[a[x]] -- ; 
}

void add(int x , int &val) {
	bucket[a[x]] ++ ; 
	val = max(val , bucket[a[x]]) ; 
}

signed main() { 
	ios :: sync_with_stdio(0) , cin.tie(0) , cout.tie(0) ; 
	cin >> n >> m ; 
	for (int i = 1 ; i <= n ; ++ i) {
		cin >> a[i] ; c[i] = a[i] ; 
	}

	stable_sort(c + 1 , c + n + 1) ; 
	p = unique(c + 1 , c + n + 1) - c - 1 ; 

	for (int i = 1 ; i <= n ; ++ i) a[i] = lower_bound(c + 1 , c + p + 1 , a[i]) - c ; 

	length = n / sqrt(m) ; int len ; 

	for (int len = 1 , i = 1 ; len <= n ; len += length , ++ i) {
		L[i] = len ; 

		if (len + length > n) R[i] = n ; 
		else R[i] = len + length ; 

		for (int j = L[i] ; j <= R[i] ; ++ j) {
			belong[j] = i ; 
		}
	}

	for (int i = 1 ; i <= m ; ++ i) {
		cin >> b[i].l >> b[i].r ; b[i].id = i ; 
		b[i].Bl = belong[b[i].l] ; b[i].Br = belong[b[i].r] ; 
	}

	stable_sort(b + 1 , b + m + 1 , [](Node a , Node b) {
		return a.Bl == b.Bl ? a.r < b.r : a.Bl < b.Bl ; 
	}) ; 

	int l = 1 , r = 0 , block = 0 ; 

	for (int i = 1 ; i <= m ; ++ i) {
		if (b[i].Bl == b[i].Br) {
			int maxn = 0 ; 

			for (int j = b[i].l ; j <= b[i].r ; ++ j) barrel[a[j]] ++ ; 
			for (int j = b[i].l ; j <= b[i].r ; ++ j) maxn = max(maxn , barrel[a[j]]) ; 
			for (int j = b[i].l ; j <= b[i].r ; ++ j) barrel[a[j]] -- ; 

			Answer[b[i].id] = - maxn ; 
			continue ; 
		}

		if (b[i].Bl != block) {
			block = b[i].Bl ; 
			int left = R[b[i].Bl] + 1 , right = left - 1 ; 

			while (r > right) deleted(r --) ; 
			while (l < left) deleted(l ++) ; 

			Ans = 0 ; 
		}

		while (r < b[i].r) add(++ r , Ans) ; 

		int tmp = Ans , Original = l ; 
		while (b[i].l < Original) add(-- Original , tmp) ; 

		Answer[b[i].id] = - tmp ; 

		while (Original < l) deleted(Original ++) ; 
	}

	for (int i = 1 ; i <= m ; ++ i) cout << Answer[i] << '\n' ; 
}

作者:hangry

出处:https://www.cnblogs.com/hangry/p/18327507

版权:本作品采用「署名-非商业性使用-相同方式共享 4.0 国际」许可协议进行许可。

posted @   HANGRY_Sol&Cekas  阅读(48)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 提示词工程——AI应用必不可少的技术
· .NET周刊【3月第1期 2025-03-02】
点击右上角即可分享
微信分享提示
more_horiz
keyboard_arrow_up light_mode palette
选择主题