Codeforces Round #539 (Div. 2) 异或 + dp】的更多相关文章

https://codeforces.com/contest/1113/problem/C 题意 一个n个数字的数组a[],求有多少对l,r满足\(sum[l,mid]=sum[mid+1,r]\),sum为异或和(n<=3e5,a[i]<=2^20) 题解 异或和为零的区间可以分成任意两个区间(这两个区间的异或和相等) 定义dp[i][j]为异或和为i,下标为j(只记录奇偶)的前缀个数 枚举r,然后累加l 代码 #include<bits/stdc++.h> #define M…
Problem   Codeforces Round #539 (Div. 2) - C. Sasha and a Bit of Relax Time Limit: 2000 mSec Problem Description Input The first line contains one integer n (2≤n≤3⋅10^5) — the size of the array. The second line contains n integers a1,a2,…,an (0≤ai<2^…
Codeforces Round #539 (Div. 2) A - Sasha and His Trip #include<bits/stdc++.h> #include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<algorithm> #include<queue> #incl…
Codeforces Round #539 (Div. 2) 题目链接:https://codeforces.com/contest/1113 A. Sasha and His Trip 题意: n个城市,城市分布在一条直线上且按升序排序,现在有个人开车从一号城市出发,车的油箱容量为v. 在每个城市都可以买油,但价格不一样:第i个城市买1单位的油花费i元.问最终从1到n花费的最少为多少. 题解: 贪心即可,尽量在前面的城市买油,最后一鼓作气到n号城市. 代码如下: #include <bits/…
Problem   Codeforces Round #539 (Div. 2) - D. Sasha and One More Name Time Limit: 1000 mSec Problem Description Input The first line contains one string s (1≤|s|≤5000) — the initial name, which consists only of lowercase Latin letters. It is guarante…
转载自:https://blog.csdn.net/Charles_Zaqdt/article/details/87522917 题目链接:https://codeforces.com/contest/1113/problem/C        题意是给了n个数字,让找出一个长度为偶数的区间[l, r],使得al ^ al+1 ^ .... ^ amid = amid + 1 ^ ... ^ ar这个等式成立(l到mid的异或和等于mid+1到r的异或和),求出有多少个满足要求的区间.    …
A.Beru-taxi 水题:有一个人站在(sx,sy)的位置,有n辆出租车,正向这个人匀速赶来,每个出租车的位置是(xi, yi) 速度是 Vi;求人最少需要等的时间: 单间循环即可: #include<iostream> #include<algorithm> #include<string.h> #include<stdio.h> #include<math.h> #include<vector> using namespace…
题目链接: http://codeforces.com/problemset/problem/213/B B. Numbers time limit per test 2 secondsmemory limit per test 256 megabytes 问题描述 Furik loves writing all sorts of problems, especially such that he can't solve himself. You've got one of his proble…
题目链接: http://codeforces.com/problemset/problem/214/B Hometask time limit per test:2 secondsmemory limit per test:256 megabytes 问题描述 Furik loves math lessons very much, so he doesn't attend them, unlike Rubik. But now Furik wants to get a good mark fo…
D. Kindergarten Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset/problem/484/D Description In a kindergarten, the children are being divided into groups. The teacher put the children in a line and associated each child wi…