二分水题,A,B,C三个数组排序,对于每个B[i],二分算出来有多少A比他小,多少C比他大,然后扫一遍出结果.O(nlog(n))水过. #include <bits/stdc++.h> using namespace std; const int MAXN = 1e5+10; int A[MAXN],B[MAXN],C[MAXN]; int n; //严格小于B[i]的数字个数 和 严格大于B[i]的数字个数 long long lnb[MAXN],unb[MAXN]; int main()…
C - Snuke Festival ....最后想到了,可是不应该枚举a[],这样要二重循环,而应该枚举b[],这样只需一重循环... #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; typedef long long ll; ; int a[maxn],b[maxn],c[maxn]; int n; int Fin…
A - Rotation Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement You are given a grid with 2 rows and 3 columns of squares. The color of the square at the i-th row and j-th column is represented by the character Cij. Write a…
水过前三道题之后,一直在写这个题,做不对.总有那么几组数据过不去... 看了看题解是最短路,这思路感觉很神奇.看了下唯一做出来这题的那人的代码,是搜索做的. 标程: 对每个数字x,向x+1建一条花费为1的边,向x * 10建一条花费为0的边,这样1---0的最短路+1就是结果了. 可能有人会疑惑9+1=10,费用确是+1这里,因为1 * 10=10已经向10建立了一条更短的边了,9+1=10那条边就不会走了. 看看代码就懂了. #include <bits/stdc++.h> using na…
题意:你需要订阅一些服务,每个服务每天需要花费\(c_i\),要从第\(a_i\)用到第\(b_i\)天,你可以购买会员,会员每天需要花费\(C\),但是这天的服务不用再另花钱了,问你订阅这些服务的最小花费是多少. 题解:对于这种某一段区间的加加减减的问题,我们首先应该考虑的是用差分,我们可以用map来做差分数组,然后遍历map累加差分数组的前缀和,再和\(C\)比较,贡献给答案就可以了. 代码: #include <bits/stdc++.h> #define ll long long #d…
A - Happy Birthday! Time limit : 2sec / Memory limit : 1000MB Score: 100 points Problem Statement E869120's and square1001's 16-th birthday is coming soon.Takahashi from AtCoder Kingdom gave them a round cake cut into 16 equal fan-shaped pieces. E869…
A - ABC/ARC Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement Smeke has decided to participate in AtCoder Beginner Contest (ABC) if his current rating is less than 1200, and participate in AtCoder Regular Contest (ARC) oth…
A - ABCxxx Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement This contest, AtCoder Beginner Contest, is abbreviated as ABC. When we refer to a specific round of ABC, a three-digit number is appended after ABC. For example,…
人生第一场 AtCoder,纪念一下 话说年后的 AtCoder 比赛怎么这么少啊(大雾 AtCoder Beginner Contest 154 题解 A - Remaining Balls We have A balls with the string S written on each of them and B balls with the string T written on each of them. From these balls, Takahashi chooses one…
AtCoder Beginner Contest 184 题解 目录 AtCoder Beginner Contest 184 题解 A - Determinant B - Quizzes C - Super Ryuma D - increment of coins E - Third Avenue F - Programming Contest 这把怎么感觉题目都比以往的ABC水啊,拜此所赐我只是程序写得慢就排名狂掉( A - Determinant 求二阶矩阵的行列式,是小学常见自定义题目(…