当前位置:网站首页>P3265 [jloi2015] equipment purchase
P3265 [jloi2015] equipment purchase
2022-07-05 06:19:00 【Strezia】
Link
Real linear basis
#define double long double
double a[N][N];
struct node {
double a[550];
int w;
bool operator < (const node &x) const {
return w < x.w;
}
}p[550];
int n, m;
double b[N][N];
bool insert(int m, double c[]) {
for(int i = m-1; i >= 0; i--) {
if(fabs(c[i]) < EPS) continue;
if(fabs(b[i][i]) < EPS) {
for(int j = 0; j < m; j++)
b[i][j] = c[j];
return true;
}
double t = c[i]/b[i][i];
for(int j = 0; j < m; j++)
if(fabs(c[i]) > EPS)
c[j] -= b[i][j] * t;
}
return false;
}
void solve() {
cin >> n >> m;
for(int i = 0; i < n; i++)
for(int j = 0; j < m; j++)
cin >> p[i].a[j];
for(int i = 0; i < n; i++)
{
cin >> p[i].w;
p[i].a[m] = p[i].w;
}
sort(p, p + n);
int cnt = 0, res = 0;
for(int i = 0; i < n; i++) {
if(insert(m, p[i].a)) {
cnt++;
res += p[i].w;
}
}
cout << cnt << ' ' << res << endl;
}
边栏推荐
- Open source storage is so popular, why do we insist on self-development?
- 中国剩余定理 AcWing 204. 表达整数的奇怪方式
- MySQL advanced part 2: storage engine
- LeetCode-54
- 2021apmcm post game Summary - edge detection
- Overview of variable resistors - structure, operation and different applications
- Daily question 1189 Maximum number of "balloons"
- Traditional databases are gradually "difficult to adapt", and cloud native databases stand out
- Simple selection sort of selection sort
- Leetcode divide and conquer / dichotomy
猜你喜欢
Overview of variable resistors - structure, operation and different applications
[2021]IBRNet: Learning Multi-View Image-Based Rendering Qianqian
QQ电脑版取消转义符输入表情
Chapter 6 relational database theory
Simple selection sort of selection sort
[2021]GIRAFFE: Representing Scenes as Compositional Generative Neural Feature Fields
1.14 - assembly line
1.13 - RISC/CISC
阿里巴巴成立企业数智服务公司“瓴羊”,聚焦企业数字化增长
SQLMAP使用教程(二)实战技巧一
随机推荐
MySQL怎么运行的系列(八)14张图说明白MySQL事务原子性和undo日志原理
11-gorm-v2-03-basic query
Filter the numbers and pick out even numbers from several numbers
Leetcode-6109: number of people who know secrets
LaMDA 不可能觉醒吗?
RGB LED infinite mirror controlled by Arduino
Single chip computer engineering experience - layered idea
传统数据库逐渐“难适应”,云原生数据库脱颖而出
SPI details
LeetCode 0108. Convert an ordered array into a binary search tree - the median of the array is the root, and the left and right of the median are the left and right subtrees respectively
New title of module a of "PanYun Cup" secondary vocational network security skills competition
MySQL advanced part 1: View
Open source storage is so popular, why do we insist on self-development?
【Rust 笔记】17-并发(上)
CPU内核和逻辑处理器的区别
Chart. JS - Format Y axis - chart js - Formatting Y axis
js快速将json数据转换为url参数
[BMZCTF-pwn] ectf-2014 seddit
Gauss Cancellation acwing 884. Solution d'un système d'équations Xor linéaires par élimination gaussienne
【Rust 笔记】14-集合(上)