Codeforces Round #688 (Div. 2)
A. Cancel the Trains
题意:给定两个数组,找出这两个数组中有多少重复元素,然后输出
思路:直接找
代码:

1 #include<iostream>
2 #include<algorithm>
3 #include<cstdio>
4 #include<cmath>
5 #include<cstring>
6 #include<map>
7 #include<queue>
8 using namespace std;
9 const int maxx=2e5+10;//14.12
10 int main(){
11 int n;
12 scanf("%d",&n);
13 while(n--){
14 int a[150]={0};
15 int b[150]={0};
16 int m,k;
17 scanf("%d %d",&m,&k);
18 for(int i=0;i<m;i++){
19 int num;
20 scanf("%d",&num);
21 a[num]++;
22 }
23 for(int j=0;j<k;j++){
24 int num;
25 scanf("%d",&num);
26 b[num]++;
27 }
28 int sum=0;
29 for(int i=0;i<150;i++){
30 if(a[i]>0&&b[i]>0){
31 sum++;
32 }
33 }
34 printf("%d\n",sum);
35 }
36 }
B. Suffix Operations
题目及解题见:一道codeforces题引发的差分学习
C. Triangles(思维题)
题意:题目中已知矩阵及其矩阵上的数字(从0-9),问最大面积的三角形:1.0-9各个数字分别构成的最大的三角形,保证顶点上是其对应的数字;2.可以替换掉矩阵中任意一个数字,把它变成任意一个数字;3.保证三角形的一个边和是水平的或者竖直的,输出各个数构成三角形的最大面积值
思路:构造,让其一个点是定住的,找到此数能到达的最大位置x和最小的位置x(纵坐标不一定相等)然后竖直方向直接改变进行变换,让其成为被改变的那个数,这样就和竖直方向平行了。水平方向的计算也是如此
代码:

1 #include<iostream>
2 #include<cstdio>
3 #include<cmath>
4 #include<cstring>
5 #include<algorithm>
6 #include<map>
7 using namespace std;
8 //const int maxxx=1e5+10;
9 int maxx[20]={0},maxy[20]={0},minx[20],miny[20],c[50]={0};
10 int ans[50]={0},p[2500][2500];
11 int main(){
12 int t;
13 scanf("%d",&t);
14 while(t--){
15 int n;
16 scanf("%d",&n);
17
18 for(int i=0;i<10;i++){
19 minx[i]=n+1;
20 miny[i]=n+1;
21 maxx[i]=0;
22 maxy[i]=0;
23 c[i]=0;
24 ans[i]=0;
25 }
26 for(int i=1;i<=n;i++){
27 for(int j=1;j<=n;j++){
28 scanf("%1d",&p[i][j]);
29 int xx=p[i][j];
30 c[xx]++;
31 maxx[xx]=max(maxx[xx],i);
32 maxy[xx]=max(maxy[xx],j);
33 minx[xx]=min(minx[xx],i);
34 miny[xx]=min(miny[xx],j);
35 }
36 }
37 for(int i=1;i<=n;i++){
38 for(int j=1;j<=n;j++){
39 int xx;
40 xx=p[i][j];
41 if(c[xx]<2){
42 continue;
43 }
44 int dx=max(i-minx[xx],maxx[xx]-i);
45 int dy=max(j-miny[xx],maxy[xx]-j);
46 ans[xx]=max(ans[xx],dx*(max(j-1,n-j)));
47 ans[xx]=max(ans[xx],dy*(max(i-1,n-i)));
48 }
49 }
50 for(int i=0;i<10;i++){
51 printf("%d",ans[i]);
52 if(i<9){
53 printf(" ");
54 }
55 }
56
57 printf("\n");
58 }
59 }
Codeforces Round #688 (Div. 2)的更多相关文章
- Codeforces Round #688(Div 2) D. Checkpoints
思路 第一步,先推导1,0,0,--,0,就是1后面跟了n-1个0的时候 所需要的期望步数 封闭式推导 \(f_n\)代表从n关开始直接通关需要的步数的期望 n为1的情况,即就只有一个1 \(f_1= ...
- Codeforces Round #366 (Div. 2) ABC
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...
- Codeforces Round #354 (Div. 2) ABCD
Codeforces Round #354 (Div. 2) Problems # Name A Nicholas and Permutation standard input/out ...
- Codeforces Round #368 (Div. 2)
直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输 ...
- cf之路,1,Codeforces Round #345 (Div. 2)
cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅..... ...
- Codeforces Round #279 (Div. 2) ABCDE
Codeforces Round #279 (Div. 2) 做得我都变绿了! Problems # Name A Team Olympiad standard input/outpu ...
- Codeforces Round #262 (Div. 2) 1003
Codeforces Round #262 (Div. 2) 1003 C. Present time limit per test 2 seconds memory limit per test 2 ...
- Codeforces Round #262 (Div. 2) 1004
Codeforces Round #262 (Div. 2) 1004 D. Little Victor and Set time limit per test 1 second memory lim ...
- Codeforces Round #371 (Div. 1)
A: 题目大意: 在一个multiset中要求支持3种操作: 1.增加一个数 2.删去一个数 3.给出一个01序列,问multiset中有多少这样的数,把它的十进制表示中的奇数改成1,偶数改成0后和给 ...
随机推荐
- 2017-2018 ACM-ICPC Northern Eurasia(A.Archery Tournament)
题目链接:https://vjudge.net/problem/Gym-101630A 题意: n个事件,t=1 代表增加一个圆心为(x,y),半径为 abs(y)的靶子,t=2,代表射击的坐标为(x ...
- 【wp】2021V&NCTF
前几天打完的V&NCTF公开赛,做题的时候没记过程,这是复现wp. 最后排名Top 18,三道RE+两道杂项(wp没啥可放的hhh)+一道web,感觉re题目还是挺好的,难度适中点赞,尤其pc ...
- Android学习之CoordinatorLayout+AppBarLayout
•AppBarLayout 简介 AppbarLayout 是一种支持响应滚动手势的 app bar 布局: 基本使用 新建一个项目,命名为 TestAppBarLayout: 修改 activity ...
- C++并发与多线程学习笔记--unique_lock详解
unique_lock 取代lock_quard unique_lock 的第二个参数 std::adopt_lock std::try_to_lock std::defer_lock unique_ ...
- elementui 表格格式化
<el-table-column prop="userType" label="角色" width="180" :formatter= ...
- ubuntu16.04 安装opencv3.4.0
参考 https://www.cnblogs.com/arkenstone/p/6490017.html https://blog.csdn.net/u013180339/article/detail ...
- inline®ister
inline关键字: 内联只是一个请求,不代表编译器会响应:同时某些编译器会将一些函数优化成为内联函数. C++在类内定义的函数默认是内联函数,具体是否真变成内联函数还需看编译器本身. registe ...
- 鸿蒙手机版JNI实战(JNI开发、SO库生成、SO库使用)
鸿蒙JNI开发现状 现阶段,不仅鸿蒙JNI相关的开发资料较少,而且Phone相关的JNI开发资料几乎没有,这对于新入行的鸿蒙开发者们来说,非常不友好. 也可能会给Android工程(使用了SO库的工程 ...
- jira 改变issue状态触发jenkins构建/发布
目录 jira中issue状态的改变触发Jenkins构建 jira中定制新的workflow,作为jenkins发布使用流程 大家可以参考我的这个workflow 设置workflow 使用Tran ...
- Java JFR 民间指南 - 事件详解 - jdk.ObjectAllocationOutsideTLAB
重新申请 TLAB 分配对象事件:jdk.ObjectAllocationOutsideTLAB 引入版本:Java 11 相关 ISSUES: JFR: RecordingStream leaks ...