2020年ICPC南京站 补题记录

news2024/9/20 11:02:42

文章目录

  • A - Ah, It's Yesterday Once More(构造)
  • E - Evil Coordinate(构造)
  • F - Fireworks(概率+三分)
  • H - Harmonious Rectangle(打表)
  • K - K Co-prime Permutation(签到)
  • L - Let's Play Curling(贪心+签到)
  • M - Monster Hunter(树形dp)

A - Ah, It’s Yesterday Once More(构造)

  • 奇妙构造。。。总的来说就是斜着,下面是出题人给的方案
    在这里插入图片描述
#include <bits/stdc++.h>
#include <bits/extc++.h>

using namespace std;
using namespace __gnu_pbds;

#define int long long
#define double long double
using i64 = long long;

typedef pair<int, int> PII;
typedef pair<int, char> PIC;
typedef pair<double, double> PDD;
typedef pair<PII, int> PIII;
typedef pair<int, pair<int, bool>> PIIB;

const int N = 2e5 + 10;
const int maxn = 1e6;
const int MAXN = 100;
const int mod = 998244353;
const int mod1 = 954169327;
const int mod2 = 906097321;
const int INF = 0x3f3f3f3f3f3f3f3f;

void solve()
{
	cout << 20 << ' ' << 20 << '\n';
	cout << "11111011111011111011\n";
	cout << "00101100101100101101\n";
	cout << "10110110110110110111\n";
	cout << "10011011011011011001\n";
	cout << "11101101101101101101\n";
	cout << "10110110110110110110\n";
	cout << "11011011011011011011\n";
	cout << "01101101101101101101\n";
	cout << "10110110110110110111\n";
	cout << "10011011011011011001\n";
	cout << "11101101101101101101\n";
	cout << "10110110110110110110\n";
	cout << "11011011011011011011\n";
	cout << "01101101101101101101\n";
	cout << "10110110110110110111\n";
	cout << "10011011011011011001\n";
	cout << "11101101101101101100\n";
	cout << "10110110110110110111\n";
	cout << "11011010011010011001\n";
	cout << "01101111101111101111\n";
}

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

	int t = 1;
	// cin >> t;
	while (t--)
	{
		solve();
	}
	return 0;
}

E - Evil Coordinate(构造)

  • 首先如果起点或者终点就是地雷,那一定没有方案
  • 记录每个方向的次数,左右和上下都可以抵消,之后左右和上下都只剩下一个方向,判断一下画个矩形就行了
  • 有个特殊情况就是如果最后只剩下一个方向,且只走这一个方向会遇到地雷,可以利用另外的方向避开这个地雷(说起来有点抽象,看代码即可)
#include <bits/stdc++.h>

using namespace std;

// #define int long long
#define double long double
using i64 = long long;

typedef pair<int, int> PII;
typedef pair<int, char> PIC;
typedef pair<double, double> PDD;
typedef pair<PII, int> PIII;
typedef pair<int, pair<int, bool>> PIIB;

const int N = 6e6 + 10;
const int maxn = 1e6;
const int MAXN = 100;
const int mod = 998244353;
const int mod1 = 954169327;
const int mod2 = 906097321;
const int INF = 0x3f3f3f3f3f3f3f3f;

void solve()
{
	int xx, yy; cin >> xx >> yy;
	string s; cin >> s;
	bool lr = 0, ud = 0;
	if (xx == 0 && yy == 0)
	{
		cout << "Impossible\n";
		return;
	}
	vector<int> cnt(4); // UDLR
	int nowx = 0, nowy = 0;
	bool flag = false;
	for (auto t : s)
	{
		if (t == 'U')
		{
			nowy ++ ;
			cnt[0] ++ ;
		}
		else if (t == 'D')
		{
			nowy -- ;
			cnt[1] ++ ;
		}
		else if (t == 'L')
		{
			nowx -- ;
			cnt[2] ++ ;
		}
		else
		{
			nowx ++ ;
			cnt[3] ++ ;
		}
		if (nowx == xx && nowy == yy) flag = true;
	}
	if (cnt[0] && cnt[1]) ud = true;
	if (cnt[2] && cnt[3]) lr = true;
	if (!flag) cout << s << '\n';
	else
	{
		if (nowx == xx && nowy == yy) cout << "Impossible\n";
		else
		{
			string ans = "";
			if (cnt[0] > cnt[1])
			{
				if (!(xx == 0 && yy == 1)) for (int i = 0; i < cnt[1]; i ++ ) ans += "UD";
				else for (int i = 0; i < cnt[1]; i ++ ) ans += "DU";
				cnt[0] -= cnt[1], cnt[1] = 0;
			}
			else
			{
				if (!(xx == 0 && yy == 1)) for (int i = 0; i < cnt[0]; i ++ ) ans += "UD";
				else for (int i = 0; i < cnt[0]; i ++ ) ans += "DU";
				cnt[1] -= cnt[0], cnt[0] = 0;
			}
			if (cnt[2] > cnt[3])
			{
				if (!(xx == -1 && yy == 0)) for (int i = 0; i < cnt[3]; i ++ ) ans += "LR";
				else for (int i = 0; i < cnt[3]; i ++ ) ans += "RL";
				cnt[2] -= cnt[3], cnt[3] = 0;
			}
			else
			{
				if (!(xx == -1 && yy == 0)) for (int i = 0; i < cnt[2]; i ++ ) ans += "LR";
				else for (int i = 0; i < cnt[2]; i ++ ) ans += "RL";
				cnt[3] -= cnt[2], cnt[2] = 0;
			}

			auto check1 = [&]()
			{
				int x = 0, y = 0;
				
				for (int i = 0; i < cnt[2]; i ++ )
				{
					x -- ;
					if (xx == x && yy == y) return false;
				}
				for (int i = 0; i < cnt[3]; i ++ )
				{
					x ++ ;
					if (xx == x && yy == y) return false;
				}
				for (int i = 0; i < cnt[0]; i ++ )
				{
					y ++ ;
					if (xx == x && yy == y) return false;
				}
				for (int i = 0; i < cnt[1]; i ++ )
				{
					y -- ;
					if (xx == x && yy == y) return false;
				}
				return true;
			};

			auto check2 = [&]()
			{
				int x = 0, y = 0;
				
				for (int i = 0; i < cnt[0]; i ++ )
				{
					y ++ ;
					if (xx == x && yy == y) return false;
				}
				for (int i = 0; i < cnt[1]; i ++ )
				{
					y -- ;
					if (xx == x && yy == y) return false;
				}
				for (int i = 0; i < cnt[2]; i ++ )
				{
					x -- ;
					if (xx == x && yy == y) return false;
				}
				for (int i = 0; i < cnt[3]; i ++ )
				{
					x ++ ;
					if (xx == x && yy == y) return false;
				}
				return true;
			};

			// 先左右后上下
			if (check1())
			{
				for (int i = 0; i < cnt[2]; i ++ ) ans += 'L';
				for (int i = 0; i < cnt[3]; i ++ ) ans += 'R';
				for (int i = 0; i < cnt[0]; i ++ ) ans += 'U';
				for (int i = 0; i < cnt[1]; i ++ ) ans += 'D';
			}
			else if (check2()) // 先上下后左右
			{
				for (int i = 0; i < cnt[0]; i ++ ) ans += 'U';
				for (int i = 0; i < cnt[1]; i ++ ) ans += 'D';
				for (int i = 0; i < cnt[2]; i ++ ) ans += 'L';
				for (int i = 0; i < cnt[3]; i ++ ) ans += 'R';
			}
			else
			{
				int tt = 0;
				for (int i = 0; i < 4; i ++ ) tt += (cnt[i] > 0);
				if (tt != 1)
				{
					cout << "Impossible\n";
					return;
				}
				else
				{
					if (cnt[0] > 0 || cnt[1] > 0)
					{
						if (!lr)
						{
							cout << "Impossible\n";
							return;
						}
						ans.pop_back(), ans.pop_back();
						ans += 'L';
						for (int i = 0; i < cnt[0]; i ++ ) ans += 'U';
						for (int i = 0; i < cnt[1]; i ++ ) ans += 'D';
						ans += 'R';
					}
					else
					{
						if (!ud)
						{
							cout << "Impossible\n";
							return;
						}
						for (int i = 0; i + 2 < ans.size(); i ++ ) ans[i] = ans[i + 2];
						ans.pop_back(), ans.pop_back();
						ans += 'U';
						for (int i = 0; i < cnt[2]; i ++ ) ans += 'L';
						for (int i = 0; i < cnt[3]; i ++ ) ans += 'R';
						ans += 'D';
					}
				}
			}
			cout << ans << '\n';
		}
	}
}

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

    int t = 1;
    cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}

F - Fireworks(概率+三分)

  • 数学渣,偷个队友的码
#include<cstdio>
int n,m,p;
long double pow(long double n,long long m)
{
    if(m==0) return 1;
    long double fl=pow(n,m/2);
    fl*=fl;
    if(m&1) fl*=n;
    return fl;
}
long double F(long long k)
{
    long double a=(long double)n*k+m;
    long double b=1-pow(1-(long double)0.0001*p,k);
    return a/b;
}
int main()
{
    int T;
    scanf("%d",&T);
    while(T--)
    {
        scanf("%d%d%d",&n,&m,&p);
        long long f=1,l=1e16;
        while(f<l)
        {
            long long dt=(l-f)/3;
            long long mid1=f+dt,mid2=f+dt*2;
            long double val1=F(mid1),val2=F(mid2);
            if(val1>val2) f=mid1+1;
            else l=mid2;
        }
        f-=500;
        if(f<=0) f=1;
        long double ans=1e300;
        ans = F(l);
        for(long long i=f;i<=f+1000;i++)
        {
            long double get=F(i);
            if(get<ans) ans=get;
        }
        if(f>1) 
        {
            if(F(f-1)<F(f))
            while(1)
            {
                f++;
            }
        }
        if(F(f+1000+1)<F(f+1000))
        {
            while(1)
            {
                f++;
            }
        }
        printf("%.10lf\n",(double)ans);
    }
    return 0;
}

H - Harmonious Rectangle(打表)

  • 小数据打表 大数据直接pow(3, n*m)
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
int ans[100][100]={{0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,15,339,4761,52929,517761,4767849,43046721,387420489,486784380,381059392,429534507},{0,0,339,16485,518265,14321907,387406809,460338013,429534507,597431612,130653412,527642103,246336683},{0,0,4761,518265,43022385,486780060,429534507,792294829,175880701,246336683,953271190,214965851,412233812},{0,0,52929,14321907,486780060,288599194,130653412,748778899,953271190,644897553,710104287,555340537,947749553},{0,0,517761,387406809,429534507,130653412,246336683,579440654,412233812,518446848,947749553,909419307,966670169},{0,0,4767849,460338013,792294829,748778899,579440654,236701429,666021604,589237756,662963356,900849429,157687433},{0,0,43046721,429534507,175880701,953271190,412233812,666021604,767713261,966670169,322934415,772681989,566494346},{0,0,387420489,597431612,246336683,644897553,518446848,589237756,966670169,968803245,954137859,295347237,319625180},{0,0,486784380,130653412,953271190,710104287,947749553,662963356,322934415,954137859,886041711,876626606,924095353},{0,0,381059392,527642103,214965851,555340537,909419307,900849429,772681989,295347237,876626606,772286045,155055959},{0,0,429534507,246336683,412233812,947749553,966670169,157687433,566494346,319625180,924095353,155055959,93330098}};
int ksm(int a, int b)
{
	int res = 1;
	while (b)
	{
		if (b & 1)
			res = res * a % mod;
		b >>= 1;
		a = a * a % mod;
	}
	return res;
}
signed main()
{
	int T;
    scanf("%lld",&T);
    while(T--)
    {
        int n,m;
        scanf("%lld%lld",&n,&m);
        if(n<=10&&m<=10) printf("%lld\n",ans[n][m]);
        else if (n == 1 || m == 1) printf("%lld\n", 0ll);
        else printf("%lld\n",ksm(3,n*m));
    }
    return 0;
}

K - K Co-prime Permutation(签到)

#include<cstdio>
#include<iostream>
using namespace std;

int a[1000005];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n,k;
    // scanf("%d%d",&n,&k);
    cin >> n >> k;
    for(int i=1;i<=n;i++)
        a[i]=i;
    if(k==0) cout << -1;
    else
    {
        for(int i=1;i<k;i++)
            a[i]=a[i+1];
        a[k]=1;
        for(int i=1;i<=n;i++){
            // printf("%d ",a[i]);
            cout << a[i] << ' ';
        }
    }
    return 0;
}

L - Let’s Play Curling(贪心+签到)

#include <bits/stdc++.h>

using namespace std;

// #define int long long
#define double long double
using i64 = long long;

typedef pair<int, int> PII;
typedef pair<int, char> PIC;
typedef pair<double, double> PDD;
typedef pair<PII, int> PIII;
typedef pair<int, pair<int, bool>> PIIB;

const int N = 6e6 + 10;
const int maxn = 1e6;
const int MAXN = 100;
const int mod = 998244353;
const int mod1 = 954169327;
const int mod2 = 906097321;
const int INF = 0x3f3f3f3f3f3f3f3f;

void solve()
{
	int n, m; cin >> n >> m;
	vector<PII> a(n + m + 1);
	set<int> st;
	for (int i = 1; i <= n; i ++ )
	{
		cin >> a[i].first;
		a[i].second = 0;
	}
	for (int i = n + 1; i <= n + m; i ++ )
	{
		cin >> a[i].first;
		a[i].second = 1;
		st.insert(a[i].first);
	}
	sort(a.begin() + 1, a.end());
	int ans = 0, tmp = 0;
	for (int i = 1; i <= n + m; i ++ )
	{
		if (a[i].second == 0)
		{
			if (st.count(a[i].first) == 0) tmp ++ ;
		}
		else
		{
			ans = max(ans, tmp);
			tmp = 0;
		}
	}
	ans = max(ans, tmp);
	if (ans == 0) cout << "Impossible\n";
	else cout << ans << '\n';
}

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

    int t = 1;
    cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}

M - Monster Hunter(树形dp)

  • 参考:2020 ICPC南京 M.Monster Hunter(树形背包)
#include <bits/stdc++.h>
#include <bits/extc++.h>

using namespace std;
using namespace __gnu_pbds;

#define int long long
#define double long double
using i64 = long long;

typedef pair<int, int> PII;
typedef pair<int, char> PIC;
typedef pair<double, double> PDD;
typedef pair<PII, int> PIII;
typedef pair<int, pair<int, bool>> PIIB;

const int N = 2e5 + 10;
const int maxn = 1e6;
const int MAXN = 100;
const int mod = 998244353;
const int mod1 = 954169327;
const int mod2 = 906097321;
const int INF = 0x3f3f3f3f3f3f3f3f;

void solve()
{
	int n; cin >> n;
	vector<vector<int>> g(n + 1);
	for (int i = 2; i <= n; i ++ )
	{
		int x; cin >> x;
		g[i].push_back(x);
		g[x].push_back(i);
	}
	vector<int> a(n + 1), sz(n + 1);
	for (int i = 1; i <= n; i ++ ) cin >> a[i];
	vector<vector<vector<int>>> dp(2, vector<vector<int>>(n + 1, vector<int>(n + 1, INF)));
	function<void(int, int)> dfs = [&](int u, int fa)
	{
		dp[0][u][0] = 0;
		dp[1][u][1] = a[u];

		for (int i = 0; i < g[u].size(); i ++ )
		{
			int j = g[u][i];
			if (j == fa) continue;
			dfs(j, u);
		}

		sz[u] = 1;
		for (int i = 0; i < g[u].size(); i ++ )
		{
			int v = g[u][i];
			if (v == fa) continue;
			for (int j = sz[u]; j >= 0; j -- )
			{
				for (int k = sz[v]; k >= 0; k -- )
				{
					dp[0][u][j + k] = min(dp[0][u][j + k], dp[0][u][j] + min(dp[0][v][k], dp[1][v][k]));
					dp[1][u][j + k] = min(dp[1][u][j + k], dp[1][u][j] + min(dp[0][v][k], dp[1][v][k] + a[v]));
				}
			}
			sz[u] += sz[v];
		}
	};
	dfs(1, -1);
	for (int i = 0; i <= n; i ++ )
	{
		if (i != 0) cout << ' ';
		cout << min(dp[0][1][n - i], dp[1][1][n - i]);
	}
	cout << '\n';
}

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

	int t = 1;
	cin >> t;
	while (t--)
	{
		solve();
	}
	return 0;
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2098054.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Git如何安装和配置

一、Git 的安装 1、Git 的官网 Git (git-scm.com) 2、下载 Git for Windows 在官网下载好 Git 的安装文件后&#xff0c;接下来就可以进行安装了。 3、安装 Git 以管理员身份运行你下载的安装文件&#xff1a; 然后就可以进入安装向导了。 4、验证是否安装成功 当安装向…

数据资产入表和数据治理的联系和区别是什么?

引言&#xff1a;数据资产入表是指将企业的数据资源以资产的形式纳入财务报表中进行管理和计量。随着信息技术的飞速发展&#xff0c;数据已成为企业的重要资产之一。数据资产能够为企业带来直接或间接的经济利益&#xff0c;如通过数据分析优化业务流程、提升客户满意度、增加…

微信小程序安卓14蓝牙连接需要打开微信附近设备权限提醒

1.wx.onBluetoothDeviceFound去搜索附近的设备如果搜索不到一个设备则默认附近设备权限没打开&#xff08;ps微信开放社区里面的 wx.getAppAuthorizeSetting接口里面的bluetoothAuthorized一样会返回“authorized”判断不了只要允许授权蓝牙&#xff0c;附近设备权限没授权依然…

class 4: vue.js 3监听器 watch

某些情况下需要监听某个响应式数据的变化&#xff0c;这时就需要使用监听器(watch)来实现了 watch的使用语法如下 选项&#xff1a;watch类型&#xff1a;{ [key: string]: string | Function | Object | Array}详解&#xff1a;watch属性是一个对象&#xff0c;该对象的键(k…

Unity (编辑器)数据持久化 之 ScriptableObject初识与创建

1.什么是ScriptableObject ScriptableObject - Unity 手册 如题&#xff0c;一个可以在Unity编辑器中方便编辑数据的工具 一个脚本继承该类&#xff0c;并且序列化或者有公共变量&#xff0c;即可在Inspector窗口看到它们 其特点&#xff1a; Q:是否可以将 ScriptableObject…

Nodejs的详细安装过程与步骤

目录 一、下载node.js 二、安装程序 三、检查是否安装成功 四、新建文件夹 五、配置环境变量 一、下载node.js 下载地址&#xff1a;Node.js — Run JavaScript Everywhere 选择想要下载的版本&#xff0c;点击Download Node.js 二、安装程序 &#xff08;1&#xff0…

食家巷桃酥,一口酥脆,满是幸福

在美食的世界里&#xff0c;总有一些味道能瞬间勾起我们的回忆&#xff0c;食家巷桃酥便是其中之一。初见食家巷桃酥&#xff0c;那金黄的色泽便让人眼前一亮。每一块桃酥都像是一件小小的艺术品&#xff0c;边缘微微隆起&#xff0c;中间微微凹陷&#xff0c;散发着诱人的香气…

文产数字化,古迹存久远——福永街道凤凰古村RV数字全景在线游览平台上线

深圳宝安区宣传文化体育发展专项资金资助、福永街道党建服务中心指导的“凤凰古村文物抢救性挖掘与传承现实虚拟&#xff08;RV&#xff09;数字化工程”项目自从2024年6月份正式启动以来&#xff0c;经紧锣密鼓地调研、采集和制作&#xff0c;目前&#xff0c;该项目已正式完工…

【HarmonyOS 4.0】应用级变量的状态管理

组件级变量的状态管理装饰器仅能在页面内&#xff0c;即一个组件树上共享状态变量。 如果开发者要实现应用级的&#xff0c;或者多个页面的状态数据共享&#xff0c;就需要用到应用级变量的状态管理。 1. LocalStorage&#xff08;LocalStorageProp/LocalStorageLink&#xff0…

软考有哪些科目一年考两次?

软考高级【系统分析师】及【系统架构设计师】是一年考两次的。 软考中级【软件设计师】和【网络工程师】也是一年考两次的。 其他科目一年都只开考一次&#xff0c;或者上半年开考&#xff0c;或者下半年开考&#xff0c;具体考试时间可看下图。 软考考题类型/数量/考试方式&…

西安运营服务体系完善的产业园在哪里?

在西安这片充满历史底蕴与创新活力的土地上&#xff0c;有一处运营服务体系完善的产业园正熠熠生辉&#xff0c;成为众多企业追逐梦想、实现发展的理想之地。 这个产业园坐落在 [西安市长安区东长安街481号]的西安国际数字影像产业园&#xff0c;园区正以其卓越的运营服务体系吸…

为什么音视频SDK成为线上招投标不可或缺的技术支持?

随着信息技术的飞速发展和数字化转型的深入&#xff0c;线上招投标已成为现代商业活动中不可或缺的部分。这一过程不仅提高了招投标的效率&#xff0c;还增强了透明度和公平性。在这个过程中&#xff0c;音视频SDK&#xff08;软件开发工具包&#xff09;作为关键技术之一&…

nvm管理node版本解决node版本冲突问题

nvm管理node版本解决node版本冲突等乱七八糟的问题 说明一、node环境检查二、安装nvm三、node安装说明 本文主要内容为nvm的安装,包括node环境的检查,nvm下载安装以及不同版本的node安装 更新时间:2024/09/01 16:39 本文仅为记录学习轨迹,如有侵权,联系删除 一、node环…

webros机器人控制软件

一、可显示轨迹。 二、可显示机器人状态&#xff0c;如速度、位置等。 三、可以对机器人进行多点导航设置并下发导航点。 技术栈&#xff1a;rosbrige_server ,vue3,ros1,robotwebtool

美畅物联丨智能安防新趋势:IPC规格参数详解与选型建议

在畅联AIoT开放云平台的应用生态中&#xff0c;"端-边-网-云-用"这一核心理念始终是我们构建视频及AIoT底座平台的基石。其中&#xff0c;网络摄像机&#xff08;IPC&#xff0c;即Internet Protocol Camera&#xff09;&#xff0c;作为端侧设备的核心成员&#xff…

2024-09-02 Ubuntu固定USB串口名(包括1拖N的USB串口)

在运行Ubuntu系统的开发板上,如果使用可插拔的USB串口,有时候程序正在运行时,如果突然连接传感器的USB串口设备被插拔了一下,这时,会发现系统中的USB串口名发生了改变。例如,插拔之前是/dev/ttyUSB0,插拔之后变成了/dev/ttyUSB3。发生这种情况的时候,有时候会导致程序无…

Harbor部署docker私人仓库

1、新建虚拟机rhel9 2、配置网络 #修改内核参数使网卡名称为ethxxx grubby --update-kernel ALL --args net.ifnames0reboot #配置网络 vim /etc/NetworkManager/system-connections/eth0.connection 内容为&#xff1a;[connection] ideth0 typeethernet interface-nameeth0…

Git创建项目

方法一 1.在gitee中新建仓库demo01&#xff0c;并勾选开源许可证&#xff0c;完成后gitee上面的项目demo01里只包含一个LICENSE文件 2.直接在本地电脑中新建项目文件夹demo01&#xff0c;双击进入这个文件夹&#xff0c;右键Git bash here&#xff0c;输入 git clone https:…

git commit添加emoji表情

先看样板&#xff1a; 完整表情见&#xff1a;gitmoji | An emoji guide for your commit messages 中文解释见&#xff1a;https://github.com/liuchengxu/git-commit-emoji-cn 示例&#xff1a; git commit -m :wrench: 修改supervisor配置 git commit -m :zap: 使用C扩展…

24.9.1(康托展开)

上星期三: 补 24牛客多校 二 C 牛客传送门 思路: 赛时写模拟写的很臭,如果用dp写就很方便 代码如下: const int N2e610; const int mod1e97; ll n; char s[N][2]; int dp[N][2]; void solve(){cin >> n;for(int i1;…