首页 > TAG信息列表 > 202006

csp 202006-2 稀疏向量(双指针)

目录题目描述扫描分析代码时间复杂度参考文章 题目传送门 题目描述 扫描 分析 首先看数据范围,肯定不能两个向量都读进来然后两重循环遍历,遇到id相等的就乘 可以用双指针的思想,先把第一个向量存起来,然后用一个指针指着第一个向量当前的坐标,然后读取第二个向量的时候移动第一个

csp 202006-1 线性分类器

题目详细说明 #include<iostream> #include<bits/stdc++.h> using namespace std; struct Point{ int x; int y; }pointA[1005],pointB[1005]; int main(){ std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n,m; cin>>n>>m

CSP_202006-1_线性分类器

题目描述 #include <iostream> #include <vector> #include <set> #include <algorithm> #include <unordered_map> #include <string> #include <cstring> using namespace std; const int INF = 0x3f3f3f3f; int main() { int n,

202006-2稀疏向量

题目 稀疏向量 题目截图: ![image-20211201234641418](C:\Users\long yongcheng\AppData\Roaming\Typora\typora-user-images\image-20211201234641418.png) 思路 60分答案 我的第一思路是开一个二维数组,相当于开了一个两行好多列的二维表(为什么说好多列呢?因为主要取决于你那个只

202006 csp认证

-1. #include<iostream> #include<vector> using namespace std; int n; int m; class Point{ public: int x; int y; char flag; }; class Linear{ public: int c; int a; int b; }; //检查是否在一边 int isSame1(Point p1,Point p2,Linear l

ccf真题 202006-1 线性分类器

样例(文本): 9 3 1 1 a 1 0 a 1 -1 a 2 2 b 2 3 b 0 1 a 3 1 b 1 3 b 2 0 a 0 2 -3 -3 0 2 -3 1 1 #include<iostream> using namespace std; struct point{ int x; int y; char type; int record; }; int main(){ int n,m; cin>>n>>m; point p[n];

202006-2 稀疏向量

注意数据内积可能溢出,需要使用long long #include <iostream> #include <unordered_map> using namespace std; int main() { int n,a,b; cin >> n >> a >>b; unordered_map<int,int> a_map; int index,value; for (int i =

CCF解题目录 (持续更新-Java)

CCF系列目录 小菜鸡的解题目录,用来督促自己攻克CCF,欢迎各位大佬指教( •̀ ω •́ )。 看到一个博主整理的题解,深受启发,这个题解用来督促自己学习,见证自己的成长。 目录 CCF系列目录习题列表总结 习题列表 试题编号试题名称题解备注202012-1期末预测之安全指数Java

【CSP认证】202006_1 线性分类器

参考文章 https://www.it610.com/article/1291013626328588288.htm 题目描述 巧妙的点 用ch1和ch2分别记录m种对应参数的情况下两个类别(大于0和小于0)的字符表示,以此推出该参数是否可取。 代码实现 //202006_1 线性分类器 #include<iostream> using namespace std; int n,

CCF CSP 202006-2 稀疏向量

202006-2 稀疏向量 题目描述 对于一个n维整数向量\(v \in \mathbb{Z^n}\),其在第\(index\)个维度上的取值记作\(v_{index}\)。这里我们约定\(index\)的取值从1开始,即\(v=(v_1,v_2,...,v_n)\)。下面介绍一种向量的稀疏表示方法。 如果\(v\)仅在少量维度上的取值不为0,则称其为稀疏向

202006-5 乔乔和牛牛逛超市

注意事项 1.A可能为0 2.最后最大流总量需要开long long #include <iostream> #include <cstring> using namespace std; const int N = 2e5 + 10, M = (1e6 + 10 + 2 * N) * 2, INF = 1e9; int h[N], e[M], ne[M], f[M], idx; int q[N], cur[N], d[N]; int p[N]; int n, m;

202006-1线性分类器

问题描述 试题编号: 202006-1 试题名称: 线性分类器 时间限制: 1.0s 内存限制: 512.0MB 样例1 9 3 1 1 A 1 0 A 1 -1 A 2 2 B 2 3 B 0 1 A 3 1 B 1 3 B 2 0 A 0 2 -3 -3 0 2 -3 1 1 AC #include<bits/stdc++.h> using namespace std; struct node { int x; int y; char t

202006-2稀疏向量

问题描述 试题编号: 202006-2 试题名称: 稀疏向量 时间限制: 2.0s 内存限制: 512.0MB 样例 10 3 4 4 5 7 -3 10 1 1 10 4 20 5 30 7 40 AC 哎,循环太多会运行超时。。。 #include<bits/stdc++.h> using namespace std; int main() { int n,a,b; cin>>n>>a>>b; int u[a][2];

CCF 202006-2 稀疏向量【map的使用】

目录 一、题目二、解析三、代码四、感想 一、题目 二、解析 主要用到map的构造和find方法。其中,map的构造如下: #include <iostream> #include <map> using namespace std; int n, a, b; map<int, int> u; map<int, int> v; int main() { cin >> n >> a >> b; for