Codeforces Round #546 (Div. 2)
http://codeforces.com/contest/1136
A
#include <bits/stdc++.h>
using namespace std; const int maxn = 1e5 + ;
int N, K; struct Node {
int L;
int R;
}node[maxn]; int main() {
scanf("%d", &N);
for(int i = ; i <= N; i ++)
scanf("%d%d", &node[i].L, &node[i].R);
scanf("%d", &K); int cnt = ;
for(int i = ; i <= N; i ++) {
if(node[i].R >= K) cnt ++;
else continue;
} printf("%d\n", cnt); return ;
}
B
#include <bits/stdc++.h>
using namespace std; int N, K; int main() {
scanf("%d%d", &N, &K);
int ans = ;
ans = * N + min(K - , N - K);
printf("%d\n", ans);
return ;
}
C (只要判断对角线上的数字就好了 如果对角线数字不同输出 NO)
#include <bits/stdc++.h>
using namespace std; const int maxn = ;
int N, M;
int a[maxn][maxn], b[maxn][maxn];
map<int, int> vis[maxn]; int main() {
scanf("%d%d", &N, &M);
for(int i = ; i <= N; i ++) {
for(int j = ; j <= M; j ++) {
scanf("%d", &a[i][j]);
vis[i + j - ][a[i][j]] ++;
}
}
bool flag = true;
for(int i = ; i <= N; i ++) {
for(int j = ; j <= M; j ++) {
scanf("%d", &b[i][j]);
if(vis[i + j - ][b[i][j]] <= )
flag = false;
vis[i + j - ][b[i][j]] --;
}
} if(flag) printf("YES\n");
else printf("NO\n"); return ;
}
D
#include <bits/stdc++.h>
using namespace std; const int maxn = 3e5 + ;
vector<int> v[maxn];
int N, M;
int num[maxn], ans[maxn]; int main() {
scanf("%d%d", &N, &M);
for(int i = ; i <= N; i ++)
scanf("%d", &num[i]);
while(M --) {
int uu, vv;
scanf("%d%d", &uu, &vv);
v[vv].push_back(uu);
} for(int i = ; i < v[num[N]].size(); i ++)
ans[v[num[N]][i]] ++; int cnt = ;
for(int i = N - ; i >= ; i --) {
if(ans[num[i]] == N - i - cnt) cnt ++;
else {
for(int j = ; j < v[num[i]].size(); j ++)
ans[v[num[i]][j]] ++;
}
} printf("%d\n", cnt);
return ;
}
很久没更新了 最近和队友训练准备这样那样的比赛 写完题好像也没贴 哭唧唧 会尽快把之前做的题总结一下发上来的 养肥我的 Be 客
Codeforces Round #546 (Div. 2)的更多相关文章
- Codeforces Round #546 (Div. 2) 题解
Codeforces Round #546 (Div. 2) 题目链接:https://codeforces.com/contest/1136 A. Nastya Is Reading a Book ...
- Codeforces Round #546 (Div. 2) E 推公式 + 线段树
https://codeforces.com/contest/1136/problem/E 题意 给你一个有n个数字的a数组,一个有n-1个数字的k数组,两种操作: 1.将a[i]+x,假如a[i]+ ...
- Codeforces Round #546 (Div. 2) D 贪心 + 思维
https://codeforces.com/contest/1136/problem/D 贪心 + 思维 题意 你面前有一个队列,加上你有n个人(n<=3e5),有m(m<=个交换法则, ...
- Codeforces Round #546 (Div. 2) ABCDE 题解
1136A: 题意:一本书有n个章节,每个章节的分别在li到ri页,小明读完书后将书折在第k页,问还有多少章节没有读 题解:控制k在li~ri的范围内后输出n-i即可 #include <set ...
- Codeforces Round #546 (Div. 2) B. Nastya Is Playing Computer Games
链接:https://codeforces.com/contest/1136/problem/B 题意: 有n个井盖,每个井盖上有一个小石头. 给出n和k,k表示刚开始在第k个井盖上方. 有三种操作, ...
- Codeforces Round #546 (Div. 2) A. Nastya Is Reading a Book
链接:https://codeforces.com/contest/1136/problem/A 题意: 给n个区间,每个区间范围不超过100,n不超过100. 给一个位置k,1-(k-1)是遍历过的 ...
- Codeforces Round #546 (Div. 2)-D - Nastya Is Buying Lunch
这道题,神仙贪心题... 题意就是我给出数的顺序,并给出多个交换,每个只能用于相邻交换,问最后一个元素,最多能往前交换多少步. 我们考虑这样一个问题,如果一个这数和a[n]发生交换,那么这个数作为后面 ...
- Codeforces Round #546 (Div. 2) C. Nastya Is Transposing Matrices
C. Nastya Is Transposing Matrices time limit per test 1 second memory limit per test 256 megabytes i ...
- Codeforces Round #546 (Div. 2) E - Nastya Hasn't Written a Legend
这题是一个贼搞人的线段树 线段树维护的是 区间和a[i - j] 首先对于update的位置可以二分查找 其次update时候的lazy比较技巧 比如更新的是 l-r段,增加的是c 那么这段的值为: ...
随机推荐
- C# -- 使用System.Environment获取电脑的相关属性
使用System.Environment获取电脑的相关属性 1.使用System.Environment获取电脑的相关属性(入门案例) static void Main(string[] args) ...
- (转载)关于usr/bin/ld: cannot find -lxxx问题总结
usr/bin/ld: cannot find -lxxx问题总结 linux下编译应用程序常常会出现如下错误: /usr/bin/ld: cannot find -lxxx 意思是 ...
- LeetCode算法题-Valid Palindrome(Java实现)
这是悦乐书的第174次更新,第176篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第33题(顺位题号是125).给定一个字符串,确定它是否是回文,只考虑字母数字字符并忽略 ...
- LeetCode算法题-Sqrt(Java实现)
这是悦乐书的第158次更新,第160篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第17题(顺位题号是69). 计算并返回x的平方根,其中x保证为非负整数. 由于返回类型 ...
- IT部门不应该是一个后勤部门
管理上最大的问题在于不重视预算与核算的管理.从管理层到员工,很少有经营的念头,只是一味地埋头做事.西方企业总结了当今几百年的经营理念,最终把企业一切活动的评价都归结到唯一的.可度量的标准上:钱来度量. ...
- mumu安卓模拟器使用教程
安装教程: 1http://mumu.163.com/ 在这网址里面下载 2.安装 我的是mac 安装时需要输入你的你电脑密码 但是也报错,你点击旁边的提示就会告诉去安全与隐私里点击允许就好了 很 ...
- Linux 27 岁了!盘点 Linux 的 27 件趣事
Linux 27 岁了!盘点 Linux 的 27 件趣事 许多人认为10月5日是 Linux 系统的周年纪念日,因为这是 Linux 在1991年首次对外公布的时间.不过,你可能不知道的是,早在19 ...
- CentOS 7 安装telnet服务
今天测试zabbix需要用到telnet服务,查询到Centos7下下载安装telnet服务的方法,特此整理记录! 一.通过yum下载安装telnet yum -y install xinetd te ...
- centos7下如何隐藏nginx的版本号
我们在访问nginx的时候会暴露nginx的版本号,如何将这些版本号隐藏呢? 其实隐藏版本号非常简单 在nginx的配置文件中添加一个server——tokens off:参数就可以了,下面进行操作 ...
- [ZJOI2011]礼物
嘟嘟嘟 正是因为有这样的数据范围,解法才比较暴力. 我们假设取出的长方体常和宽相等,即\(a * a * b\).这样我们每次换两条边相等,搞三次就行. 那么对于第\(k\)层中的第\((i, j)\ ...