csa Round #73 (Div. 2 only)】的更多相关文章

Three Equal Time limit: 1000 msMemory limit: 256 MB   You are given an array AA of NN integers between 00 and 22. With cost 11 you can apply the following operation A_i = ((A_i + 1)\ \% \ 3)A​i​​=((A​i​​+1) % 3). Find the minimum cost to make all ele…
Rikka with Phi  Accepts: 5  Submissions: 66  Time Limit: 16000/8000 MS (Java/Others)  Memory Limit: 131072/131072 K (Java/Others) Problem Description Rikka and Yuta are interested in Phi function (which is known as Euler's totient function). Yuta giv…
Rikka with Graph  Accepts: 123  Submissions: 525  Time Limit: 2000/1000 MS (Java/Others)  Memory Limit: 65536/65536 K (Java/Others) 问题描述 众所周知,萌萌哒六花不擅长数学,所以勇太给了她一些数学问题做练习,其中有一道是这样的: 给出一张 nn 个点 n+1n+1 条边的无向图,你可以选择一些边(至少一条)删除. 现在勇太想知道有多少种方案使得删除之后图依然联通.…
Rikka with Chess  Accepts: 393  Submissions: 548  Time Limit: 2000/1000 MS (Java/Others)  Memory Limit: 65536/65536 K (Java/Others) 问题描述 一个n \times mn×m的黑白相间的棋盘,每次可以选择一个矩形把其中的所有格子反色.问把所有格子变成一种颜色时的最少操作次数. 输入描述 第一行一个整数 T(T \leq 10)T(T≤10) 表示数据组数. 每组数据有…
Codeforces Beta Round #73 (Div. 2 Only) http://codeforces.com/contest/88 A 模拟 #include<bits/stdc++.h> using namespace std; #define lson l,mid,rt<<1 #define rson mid+1,r,rt<<1|1 #define sqr(x) ((x)*(x)) #define pb push_back #define eb emp…
1001 Rikka with Chess ans = n / 2 + m / 2 1002 Rikka with Graph 题意:n + 1条边,问减去至少一条使剩下的图连通的方案数. 分析:原来暴力选一条或两条就行了,脑子笨了.判连通用BFS或并查集,此题并查集更好 #include <cstdio> #include <cmath> #include <cstring> #include <algorithm> #include <vector…
Rikka with Chess Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 177    Accepted Submission(s): 161 Problem Description Yuta gives Rikka a chess board of size n×m. As we all know, on a chess boa…
csa66 Risk Rolls Time limit: 1000 msMemory limit: 256 MB   Alena and Boris are playing Risk today. We'll call an outcome the sum of values on the faces of 111 or more rolled dice. Alena has NNN possible outcomes whilst Boris has MMM. In turns, each o…
传送门 题意 给出一个数组A,你有一个数组B(一开始全为0),询问多少次操作后B转化为A 一次操作:选择一段区间,加上某个正整数 分析 构建一个栈, 输入一个数,若当前栈空或栈顶元素比输入小,则加入栈中,否则若大于栈顶元素,则删去栈顶元素,放入输入元素,复杂度O(n) trick 代码 #include <bits/stdc++.h> using namespace std; #define ll long long #define F(i,a,b) for(int i=a;i<=b;+…
传送门 题意 给出一个排列,定义\(value为\sum_{i=1}^{n-1}abs(f[i+1]-f[i])\) \(swap(a[i],a[j])(i≠j)为一次交换\),询问最少的交换次数使得value最大 分析 如果f[i+1]>f[i],答案就+f[i+1]-f[i]; 如果f[i+1]<f[i],答案就+f[i]-f[i+1]; 那么我们可以找到一个pretty good solution 定义 L 为 f[i]<=n/2, R 为 f[i]>n/2, 得到L R L…