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 那么这段的值为: ...
随机推荐
- Linux端口映射,80端口映射到8080端口
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080 其中eth0为外网网卡名称 ipt ...
- Windows下mysql服务的安装与卸载
安装 mysqld -install 也可以指定mysql安装服务的文件 my.ini文件配置好后就可以在cmd中安装mysqld服务了,在cmd中运行命令:mysqld --install MySQ ...
- C# 基础知识之 Unix 时间戳转换
unix时间戳是从1970年1月1日(UTC/GMT的午夜)开始所经过的秒数,不考虑闰秒. /// 时间戳转为C#格式时间 private DateTime GetTime(string timeSt ...
- Ubuntu16.04 下 hadoop的安装与配置(伪分布式环境)
一.准备 1.1创建hadoop用户 $ sudo useradd -m hadoop -s /bin/bash #创建hadoop用户,并使用/bin/bash作为shell $ sudo pass ...
- IOT,笔记:avrdude: ser_open(): can't open device "\\.\COM3": 系统找不到指定的文件。
1.下载驱动:https://www.arduino.cc/ 下载后解压 2.UNO板子以及驱动的相关设置 将UNO板子用数据线连接到电脑上,设置驱动: 打开设备管理器----->找到端口--- ...
- python入门学习:4.if语句
python入门学习:4.if语句 关键点:判断 4.1 一个简单的测试4.2 条件测试4.3 if语句 4.1 一个简单的测试 if语句基本格式如下,注意不要漏了冒号 1if 条件 :2 ...
- [SHOI2015]超能粒子炮·改
嘟嘟嘟 先看了一遍lucas,还是只能拿50分(似乎已经满足了). 正解当然还是看某个大佬的啦. 我们要求的就是 \[f(n, k) = \sum _ {i = 0} ^ {k} C _ {n} ^ ...
- 在Windows .NET平台下使用Memcached (Enyim使用)
1. 启动并配置Memcached的服务端 1. 下载Memcached http://download.csdn.net/download/ful1021/7969231 2. 解压到任意目录下, ...
- mount --bind使用方法
我们可以通过mount --bind命令来将两个目录连接起来,mount --bind命令是将前一个目录挂载到后一个目录上,所有对后一个目录的访问其实都是对前一个目录的访问,如下所示: ## test ...
- Leetcode 1. Two Sum (Python)
refer to https://blog.csdn.net/linfeng886/article/details/79772348 Description Given an array of int ...