AtCoder | ARC064 | 题解

AtCoder ABC336 A-D题解 AtCoder ABC336 题解 阅读详情

ARC064

感觉这场还是挺简单的(但这并不影响我仍然不会做QwQ

E E E题感觉啥都想到了。…知道要去求最短路…但却没有想到dij…???(smg

C. Boxes and Candies

肯定是尽量改 [ 2 , n − 1 ] [2,n-1] [2,n−1]的嘛…所以你就一遍扫下来就行啦呀

#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e5 + 10;
ll a[N];

int main() {
	int n, x;
	cin >> n >> x;
	for(int i = 1; i <= n; ++i) {
		scanf("%lld", &a[i]);
	}
	ll pos = 0;
	for(int i = 2; i <= n; ++i) {
		ll gg = max(0ll, (a[i] + a[i - 1]) - x);
		a[i] -= min(a[i], gg);
		pos += gg;
	}
	printf("%lld\n", pos);
	return 0;
}
D.An Ordinary Game

可以发现

  • 如果头和尾是相同的话 假设这么一个串 a b a b a ababa ababa( b b b可以为任意字符)

    那么长度为奇数的话必败

  • 如果头和尾不相同 那么这么一个串 a c a c acac acac( a , c a,c a,c也可以为任意字符)

    那么长度为偶数的话必败

#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
char lx[N];

int main() {
	scanf("%s", lx + 1);
	int len = strlen(lx + 1);
	if(lx[1] == lx[len]) {
		if(len & 1) printf("Second\n");
		else printf("First\n");
	} else {
		if(len & 1) printf("First\n");
		else printf("Second\n");
	}
	return 0;
}
E.Cosmic Rays

把每一个圆当作一个点 (圆和圆之间的距离是圆心距离-半径和 和 0 0 0取个max就行啦)

然后你跑一遍最短路就行了

#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
const double inf = 1e-12;
struct Point {
	double x, y;
} c[N];
int vis[N];
double R[N], f[N];

double pf(double x) {
	return x * x;
}

double dis(Point A, Point B) {
	return sqrt(pf(A.x - B.x) + pf(A.y - B.y));
}

double get(int k, int j) {
	return max(0.0, dis(c[k], c[j]) - (R[k] + R[j]));
}

int main() {
	for(int i = 1; i <= 2; ++i) {
		scanf("%lf%lf", &c[i].x, &c[i].y);
		R[i] = 0;
	}
	int n;
	scanf("%d", &n);
	n += 2;
	for(int i = 1; i <= n; ++i) f[i] = 3e9;
	for(int i = 3; i <= n; ++i) {
		scanf("%lf%lf%lf", &c[i].x, &c[i].y, &R[i]);
	}
	f[1] = 0;
	for(;;) {
		int be = -1;
		for(int i = 1; i <= n; ++i) {
			if(vis[i]) continue;
			if(be == -1 || f[be] > f[i]) be = i;
		}
		if(be == -1) break;
		vis[be] = 1;
		for(int i = 1; i <= n; ++i) {
			f[i] = min(f[i], f[be] + get(i, be));
		}
	}
	printf("%.12f\n", f[2]);
	return 0;
}
F.Rotated Palindromes

我们设 f [ i ] f[i] f[i]表示长度为 i i i且没有长度大于1的循环节的回文串个数

那么显然 f [ i ] = k ⌈ i 2 ⌉ − ∑ d ∣ i f [ d ] f[i]=k^{\lceil{\dfrac{i}{2}}\rceil}-\sum_{d|i}f[d] f[i]=k⌈2i​⌉−∑d∣i​f[d]

由于每次你只需要根号级别复杂度…所以这个可以很快处理出来

那么最后的 a n s = ∑ d ∣ n [ d &amp; 1 ] ∗ d ∗ f [ d ] + [ ! ( d &amp; 1 ) ] ∗ d 2 ∗ f [ d ] ans=\sum_{d|n}[d\&amp;1]*d*f[d]+[!(d\&amp;1)]*\dfrac{d}{2}*f[d] ans=∑d∣n​[d&1]∗d∗f[d]+[!(d&1)]∗2d​∗f[d]

因为长度为偶数时 移到一半的时候就会开始重复 所以要除以2

#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int mod = 1e9 + 7;
int n, k;
map<int, ll> f;

ll add(ll x, ll y) {
	return (x + y + mod) % mod;
}

void Add(ll &x, ll y) {
	x = (x + y + mod) % mod;
}

ll mul(ll x, ll y) {
	return (x * y) % mod;
}

void Mul(ll &x, ll y) {
	x = (x * y) % mod;
}

ll q_pow(ll x, int y) {
	ll ans = 1;
	for(; y; y >>= 1) {
		if(y & 1) Mul(ans, x);
		Mul(x, x);
	}
	return ans;
}

ll get(int x) {
	if(!f.count(x)) {
		int len = sqrt(x);
		ll pos = q_pow(k, (x / 2) + (x & 1));
		for(int i = 2; i <= len; ++i) {
			if(x % i) continue;
			Add(pos, -get(i));
			if(i * i != x) Add(pos, -get(x / i));
		}
		if(x != 1) Add(pos, -k);
		return f[x] = pos;
	} else return f[x];
}

int main() {
	scanf("%d%d", &n, &k);
	int len = sqrt(n);
	ll ans = 0;
	for(int i = 1; i <= len; ++i) {
		if(n % i) continue;
		if(i & 1) Add(ans, mul(i, get(i)));
		else Add(ans, mul(i / 2, get(i)));
		if(i * i != n) {
			int now = n / i;
			if(now & 1) Add(ans, mul(now, get(now)));
			else Add(ans, mul(now / 2, get(now)));
		}
	}
	printf("%lld\n", (ans + mod) % mod);
	return 0;
}

本文作者:Averyta

博客地址:https://blog.youkuaiyun.com/AngryVegetable

AtCoder Beginner Contest 172 E - NEQ(二项式反演) AtCoder Beginner Contest 172 E - NEQ 题意: 求满足下列条件的长度为 NNN且包含 [1,M][1, M][1,M]范围内整数的序列 A1,A2,⋯ ,ANA_1, A_2, \cdots, A_NA1​,A2​,⋯,AN​及 B1,B2,⋯ ,BNB_1, B_2, \cdots, B_NB1​,B2​,⋯,BN​组成的序列对数量。 ∀1≤i<j≤N,  Ai≠Aj∧Bi≠Bj\forall 1 \le i \lt j \le N, \; A_i \neq A_ 阅读详情

相关推荐

Mask2former自定义数据集实现滑坡语义分割

先介绍一下这次用的数据集:Bijie Landslide Dataset,是武汉大学在Triplesat卫星上裁剪的数据集,包含770张滑坡(image、mask、dem、边界坐标txt)和2003张非滑坡数据(dem、image)。直接在ade20k修改,按照路径和设置将预处理数据放好,该步骤很快就能结束,打开的图片是全黑的,因为0和1在图片上肉眼较难区分。bijie的数据集可以直接使用,接下去的步骤是1、预处理数据。配置文件修改训练类别和训练类型,由于我们分割的是滑坡,所以进行语义分割。

weixin_57812838的博客 2214

AtCoder Regular Contest 064 ,D An Ordinary Game(博弈,一定会产生某种结果)

题目描述: D - An Ordinary Game Time Limit: 2 sec / Memory Limit: 256 MB Score :500500points Problem Statement There is a stringssof length33or greater...

又菜又爱玩 315

微信取证不求人:最新免费DAT解码工具使用指南(含闪退解决方案)

本文提供了一份详细的微信DAT文件免费解码工具使用指南。针对用户常见的图片无法查看问题,手把手教学如何安全获取并操作开源图形化工具,将加密的DAT文件一键还原为JPG/PNG图片。文章重点剖析了DAT文件的加密原理,并给出了详细的步骤解决工具运行中最常见的“程序闪退”等疑难杂症,帮助普通用户轻松完成微信取证。

m0n1o2p的博客 479

AtCoder题解集锦

AtCoder题解集锦 自己从全网整理的一些优质AtCoder题解,目前只有ABC(AtCoder Beginner Contest)的C~F。不定期更新。 如您有更多需求,欢迎私信我或在评论区留言! 用法 表格查找 找到对应比赛的行 找到对应题目的列 该位置即为对应的题解 题号查找 在浏览器中按下搜索快捷键Ctrl+F,调出搜索窗口。 输入对应的题号,如244F 找到对应题解 标题查找 在浏览器中按下搜索快捷键Ctrl+F,调出搜索窗口。 输入题目标题,如Shortest Good

天生我材必有用,千金散尽还复来。 1万+

博士申请-考核制经验分享(2)——个人简历

申博过程中一般在联系导师时就将个人简历作为邮件附件,有些学校也会在提交材料或者复试阶段提交个人简历。

weixin_49282401的博客 5522

旋转矩阵推导

推导前提: 坐标使用右手坐标系,角度逆时针旋转为正。 绕X轴旋转角度为 俯仰角 即Pitch 绕Y轴旋转角度为 偏航角 即Yaw(Head) 绕Z轴旋转角度为 翻滚角 即Roll 一、平面二维坐标点的旋转 如右图所示,根据三角函数关系,可以列出向量OP与OP’的坐标表示形式: x = |OP|•cosα x′ = |OP|•cos(α+β) y = |OP|•sinα y′ = |OP|•sin(α+β) 将P′(x′,y′)表达式展开: x′ =

suixinger_lmh的随笔 1384

AtCoder Beginner Contest 288题解(A-G)

AtCoder Beginner Contest 288题解(A-G)

weixin_64008869的博客 1230

【新手必看】挖漏洞流程指南,黑客手把手教你挖漏洞月入过万!收藏这篇就够了!(附学习笔记)

【新手必看】挖漏洞流程指南,黑客手把手教你挖漏洞月入过万!收藏这篇就够了!(附学习笔记)【新手必看】挖漏洞流程指南,黑客手把手教你挖漏洞月入过万!收藏这篇就够了!(附学习笔记)

weixin_57514792的博客 1103

AtCoder Beginner Contest 214 G. Three Permutations(组合数学 容斥 背包 二项式反演)

剩下n-i个随便选(可能冲突),乘以n-i的阶乘,转化成至少冲突i次的方案数。1. 如果选了(1,n),对应长为n-2的链上选k-1对匹配的方案,在新环上:则认为是在长度为2*n的环上,选择一对相邻的点两两匹配,剩下的随便选,转化成至少冲突k次的方案数,利用二项式反演解决。2. 如果没选(1,n),对应长为n的链选k对匹配的方案,暴力合并背包,得到恰好选了i个冲突的点的方案数,由于原来长为n的环变为新的长为2n的环,考虑容斥,算恰好冲突的k次的方案数,对于环来说,一个长为n的环,

小衣同学的博客 546

WhatsApp协议算法

我想其实有很多人还不太了WhatsApp群控,简单来说,它和我们常使用的微信聊天软件是类似的,只不过它是基于通讯录的,操作起来比较简单便捷,所以现在有很多国家都喜欢用WhatsApp。一般情况下,筛号不会造成账号被封的情况,但是呢,如果筛号的频率太快,就会被系统限制筛号能力,不再返回筛号结果,所以,筛号数量和速度一定要控制好。前天逛街突然灵光一现,为什么不试试多路访问呢,简单来说就是信道复用技术,马上跑回家,调取接口,接入通道,导入已经转换成协议的账号,成功登录!

2403_87755661的博客 1942

Qt基础之十九:进程与QProcess

进程就是一个程序的执行实例,也就是正在运行的程序。对操作系统来说,进程就是一个担当分配系统资源CPU时间、内存的实体。在Qt 中,我们使用QProcess来表示一个进程。这个类可以允许我们的应用程序启动一个新的外部程序,并且与这个程序进行通讯。当外部程序开始启动时,QProcess的状态为Starting;外部程序已经启动时,QProcess的状态为Running,并发送started()信号;当外部层序退出了,QProcess的状态为NotRunning(初始状态),并发送finished()信号。

草上爬的博客 1万+

AtCoder整理(持续更新中……)

做了那么久的atcoder觉得自己的题解发的很乱 给有想和我一起交流atcoder题目(或者指出我做法的很菜)(或者指责我为什么整场比赛只会抄题解)的同学一个索引的机会??? 于是写了个爬虫爬了下 AtCoder整理 AGC 【AtCoder】AGC034 【AtCoder】AGC033 【AtCoder】AGC032 【AtCoder】AGC031 【AtCoder】AGC030 【A...

weixin_30364147的博客 330

讲透 ABAP CDS 注解名称:简单名、结构化名、@ 与 @<、作用域与分组

本文从开发者角度梳理ABAP CDS注解的命名规则与实战写法,重点解析: 语法规则:@与@<的使用场景、结构化命名规范、作用域唯一性要求 评估机制:ABAP运行时与组件框架的注解处理差异 分组技巧:花括号分组简化重复前缀的书写 实战示例:包含完整CDS View Entity(演示注解分组与@<用法)和ABAP报表(读取打印注解) 常见问题:命名错误导致激活失败、框架忽略等注意事项 最后通过航空预订统计案例,展示如何结合多种注解类型实现业务需求。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 261

AtCoder Regular Contest

一句话题解 因为上篇AGC的写的有点长……估计这篇也短不了所以放个一句话题解方便查阅啥的吧QwQ 具体的题意代码题解还是往下翻…… ARC 058 D:简单容斥计数。 E:用二进制表示放的数字,然后状压$DP$。 F:$biset$优化$DP$预处理,乱搞贪心。 ARC 059 D:傻题,存在长的合法子串就一定会存在短的。 E:前缀和优化$DP$。 F:每个长度为$len$的串...

weixin_34150503的博客 1225

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

ARC 刷题记录 · 壹 | 错题本

文章目录10.22[ARC058B] Iroha and a Grid[ARC058C] Iroha and Haiku[ARC059C] Children and Candies[ARC059D] Unhappy Hacking 标红的表示看了题解。 10.22 [ARC058B] Iroha and a Grid 简单计数题,总方案减不合法的即可,不合法的可以枚举 A×BA \times BA×B 的矩形的一个对角线计算。 #include <bits/stdc++.h> const in

ixRic 540

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

[AtCoder ARC077 .F] [字符串] [乱搞] SS

翻译下题解…可以发现一次变化是f(SS)=STSTf(SS)=STST,其中TT是S的一个前缀,|T||T|是S的最小周期 那么我们就只需要考虑变化g(S)=STg(S)=ST,因为不断变化1010010^{100}次的话,后面的部分就可以省去设TT的长度为dd,SS的长度是nn 可以证明如果d|nd|n,那么g(ST)=STTg(ST)=STT 否则,g(ST)=STSg(ST)=STS那么

CE玩家 1061

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

AtCoder - 2154 Cosmic Rays

E - Cosmic RaysTime limit : 2sec / Memory limit : 256MB Score : 600 pointsProblem StatementOn the xy-plane, Snuke is going to travel from the point (xs,ys) to the point (xt,yt).He can move in arbitra...

PinesL 503

atcoder:Tokio Marine & Nichido Fire Insurance Programming Contest 2020:E - O(rand)(位运算+二项式反演)

题目大意:从 N 个数字中选 1 到 k 个,使得这些数字的与运算结果为 s, 或运算结果为 t,为有多少种选择方案。 首先我们只关注 集合a 中满足 (x & s) == s && (x & t) == x 的元素 x,称这个集合为 X:{x},令 t = t ^ s,通过预处理,将 t 中为 1的位提出来,此时问题等价于:s = 0, t = 2L−12^L - 12L−1。 这相当于要从集合 X 中选出 [1,k] 个元素作为一个新的集合,使得这个新集合中在这 L .

qq_41997978的博客 914

ATCODER ABC C题解

set_target_properties(mypass1 PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) #---->修改 项目名称。set(LLVM_DIR "D:/LLVM/llvm-project/build/lib/cmake/llvm")#---->修改 llvm cmake配置路径。target_compile_options(mypass1 PRIVATE /utf-8)#---->修改 项目名称,文件名。

sFi7abSRK的博客 186

AtCoder Beginner Contest 324题解(F,G)

为了让移除大于某个数操作的erase操作最少,可以用两个set以对顶堆的形式维护中位数,若给定数大于中位数,则把原序列不断弹出最大的,若小于中位数,则交换两序列位置,不断弹出最小的元素给原序列的位置。题意:给定一个1-N的排列作为序列0,然后不断从此前某个序列中要么移除第k个元素之后的所有元素组成新序列,要么移除大于某个数的所有元素构成新序列。原操作相当于对序列不断的分拆,我们倒过来考虑对序列不断的合并,而且总让序列短的合并进序列长的,被合并的元素由于每次合并后所在序列长度增加一倍,最多被合并。

weixin_44589861的博客 248

ABC 321 A-F

ABC321

qq_73994342的博客 446

Atcoder AGC002 题解

A - Range Product 如果区间包含0就输出Zero,如果负数的个数是奇数个就输出Negative,否则输出Positive #include&lt;bits/stdc++.h&gt; using namespace std; #define RI register int int a,b; int main() { scanf("%d%d",&amp;a,&amp;b); if(...

litble的成(tui)长(fei)史 742

Atcoder-abl_d-Flat Subsequence题解(线段树+dp)

ACL Beginner Contest D - Flat Subsequence(线段树+dp)

qq_42987482的博客 396

Atcoder Beginner Contest 356题解(D、E)

出现的次数,可以对这个桶数组再求个前缀和,则可以用这个前缀和数组。的二进制表示中1的个数,所以可以按位考虑,考虑有多少个。写代码时注意取模操作,传入函数中的参数也应该取模。,因为后者是调和级数,所以时间复杂度就是。,那么我们这样操作的时间复杂度就是。考虑如果a数组中的元素各不相同。排序以方便理解)从前往后枚举。,我们发现这个x的最大值就是。地求出某一连续值域中出现的。中的每一个元素,求当前位置。对于每个x,我们可以用。倍的情况并且注意把相同的。,那么这两个位一定都是。,可以开个桶来存储每个。

光mon的博客 1111
上一篇: 算法 | 动态dp学习笔记 | 未完待更
下一篇: 一些题解的传送门qwq
Averyta
博客等级 码龄7年 1粉丝 16原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值