CodeForces-999A-Mishka and Contest】的更多相关文章

codeforces 703E Mishka and Divisors 题面 给出大小为\(1000\)的数组和一个数\(k\),求长度最短的一个子序列使得子序列的元素之积是\(k\)的倍数,如果有多个解输出元素和最小的序列. \(k\)和数组元素的数量级都是\(1e12\). 题解 \(f[i][d]\)表示前\(i\)项是\(d\)的倍数的最优解.因为\(d\)只可能是\(k\)的因数,所以离散化一下\(k\)的因数即可. 过程中需要多次求\(gcd\),直接求会超时.需要先预处理\(b[i…
链接 Codeforces 703D Mishka and Interesting sum 题意 求区间内数字出现次数为偶数的数的异或和 思路 区间内直接异或的话得到的是出现次数为奇数的异或和,要得到偶数的需要把区间内出现过的数字不重复的再异或一遍.离线按右端点排序,每次处理一个区间时,如果该数字出现过,则在树状数组中把这个数删去,再重新再该位置加到树状数组中. 代码…
B. Mishka and trip time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output Little Mishka is a great traveller and she visited many countries. After thinking about where to travel this time, she cho…
[题目链接] http://codeforces.com/contest/703/problem/D [题目大意] 给出一个数列以及m个询问,每个询问要求求出[L,R]区间内出现次数为偶数的数的异或和. [题解] 显然,我们很容易求出区间内出现次数为奇数的数的异或和,那么如果我们可以求出区间内出现的所有数的异或和,那么将两者异或就可以得到要求的东西. 我们记一个数字上一次出现的位置为pre,对于[L,R]中的数,如果其pre是小于L的,那么它肯定是第一次在这个区间出现,所以现在问题就转化为求[L…
C - Preparing for the Contest Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 377B Description Soon there will be held the world's largest programming contest, but the testing system sti…
Mishka started participating in a programming contest. There are nn problems in the contest. Mishka's problem-solving skill is equal to kk. Mishka arranges all problems from the contest into a list. Because of his weird principles, Mishka only solves…
http://codeforces.com/contest/1029/problem/B You are given a problemset consisting of nn problems. The difficulty of the ii-th problem is aiai. It is guaranteed that all difficulties are distinct and are given in the increasing order. You have to ass…
题目链接:http://codeforces.com/problemset/problem/369/B 题目意思:给出6个整数, n, k, l, r, sall, sk ,需要找出一个满足下列条件的序列:1. l <= 每一个数 <= r   2.整个序列的数的和为sall       3.取得最高分数的那k个人的总分数恰好(注意,是刚刚好,多了或少了都不可,而且这k个人的分数不一定都是相等的)等于sk.(至于后面的那句 if a1, a2, ..... sk = a1 + a2 + ...…
简单题. #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> #include<vector> #include<map> #include<set> #include<queue> #inc…
140D - New Year Contest 思路:贪心+排序.罚时与时间成正比,因为在0点前做完的题都可以在0点提交.从时间短的开始做最优. 代码: #include<bits/stdc++.h> using namespace std; ; const int INF=0x3f3f3f3f; int a[N]; int main() { ios::sync_with_stdio(false); cin.tie(); int n; cin>>n; ;i<n;i++) {…