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 那么这段的值为: ...
随机推荐
- SSH File Transfer遇到错误"too many authentication failures for root".A protocol error was detected......
在SSH Secure Shell 连接Linux centos的时候,遇到F-Secure SSH File Transfer错误"too many authentication fai ...
- FastCGI Error Number: 5 (0x80070005).
在访问网站的时候,出现了以上这个错误: 在网上搜了很多方法,归纳起来就如下几种: 1, 网站安全狗]的安全策略问题 解决方案: 主动防御/禁止IIS执行程序 添加"php\php-cgi.e ...
- 4.6Python数据处理篇之Matplotlib系列(六)---plt.hist()与plt.hist2d()直方图
目录 目录 前言 (一)直方图 (二)双直方图 目录 前言 今天我们学习的是直方图,导入的函数是: plt.hist(x=x, bins=10) 与plt.hist2D(x=x, y=y) (一)直方 ...
- Ubuntu18.04多个版本GCC编译器的切换
今天make一个程序的时候,发现程序里面使用到了C++17的标准,而我的gcc仍然是4.8,考虑到系统是ubuntu18.04的,所以感觉应该gcc的版本不会这么低. cd到/usr/bin下,使用指 ...
- Unity 琐碎(4) 可视化辅助调试Giamos
Gizmos 类 可以在代码中绘制一些输出结果或者中间输出内容,比如计算后的包围盒等等 类变量 方法 作用 color 控制输出颜色 matrix Set the gizmo matrix used ...
- js开发打印证书功能(二)
在上一篇的基础上,实现了一下另外一种方式. 上一篇地址:https://www.cnblogs.com/ljwsyt/p/9525290.html 首先,该方式也是有几种方法. 1.在上一篇的基础上, ...
- Linux的基础命令
-shutdown –h now(root用户才有效) 立即关机 -shutdown –r now(root用户才有效) 立即重新启动计算机 -reboot ...
- https验证证书的三个级别
一.无条件信任证书 1. func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge ...
- [1] YOLO 图像检测 及训练
YOLO(You only look once)是流行的目标检测模型之一, 原版 Darknet 使用纯 C 编写,不需要安装额外的依赖包,直接编译即可. CPU环境搭建 (ubuntu 18.04) ...
- pgsql SQL复杂查询示例
每天学习一点点 编程PDF电子书.视频教程免费下载:http://www.shitanlife.com/code WITH tmp AS(SELECT sum(sessioncount) as v ...