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 那么这段的值为: ...
随机推荐
- kafka_2.11-2.0.0_介绍
1. JMS是什么 1.1. JMS的基础 JMS是什么:JMS是Java提供的一套技术规范 JMS干什么用:用来异构系统 集成通信,缓解系统瓶颈,提高系统的伸缩性增强系统用户体验,使得系统模块化和组 ...
- LeetCode算法题-Ugly Number(Java实现-四种解法)
这是悦乐书的第199次更新,第208篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第64题(顺位题号是263).编写一个程序来检查给定的数字是否是一个丑陋的数字.丑陋的数 ...
- 【夯实Ruby基础】Ruby快速入门
本文地址: http://www.cnblogs.com/aiweixiao/p/6664301.html 文档提纲 扫描关注微信公众号 1.Ruby安装 1.1)[安装Ruby] Linux/Uni ...
- 转://RMAN跨平台可传输表空间和数据库
参考链接: http://blog.itpub.net/23135684/viewspace-776048/ http://blog.sina.com.cn/s/blog_69e7b8d7010164 ...
- iframe 加载闪过白块问题
每天学习一点点 编程PDF电子书.视频教程免费下载:http://www.shitanlife.com/code 在使用iframe时,iframe背景为白块,刷新时也会闪过白块.如果刷新时间长,就会 ...
- 002_pip安装失败
一.安装cmdb的驱动遇到了如下问题 [root@localhost 003_pyenv]# pip2.7 install cmdb_sdk==0.3.1 -i http://cmdb.elenet. ...
- remix的使用
remix首先,这个东西其实是有一个线上版本的,只要登录上网址:https://remix.ethereum.org就可以直接使用了,但是我更多用的是本地配置的remix-ideremix-ide的文 ...
- 二维数组遍历的方式(for普通循环遍历、foreach循环遍历、toString方式遍历)
package com.Summer_0421.cn; import java.lang.reflect.Array; import java.util.Arrays; /** * @author S ...
- ajax全局事件
作用:当你的页面存在很多ajax事件的话,我们有一些信息是公共的,可以复用,我们可以用全局事件进行编写,因为每一个ajax事件调用,都会触发ajax全局事件. jquery的ajax方法的全部全局事件 ...
- js 捕捉滚动条事件
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...