当前位置:网站首页>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;
}
边栏推荐
- Golang uses context gracefully
- 什么是套接字?Socket基本介绍
- Traditional databases are gradually "difficult to adapt", and cloud native databases stand out
- Records of some tools 2022
- [rust notes] 16 input and output (Part 1)
- Traversal of leetcode tree
- Appium automation test foundation - Summary of appium test environment construction
- QQ电脑版取消转义符输入表情
- Doing SQL performance optimization is really eye-catching
- Matrixdb V4.5.0 was launched with a new mars2 storage engine!
猜你喜欢

SQLMAP使用教程(一)

Data visualization chart summary (I)

Open source storage is so popular, why do we insist on self-development?

Is it impossible for lamda to wake up?

MySQL advanced part 1: index

RGB LED infinite mirror controlled by Arduino

做 SQL 性能优化真是让人干瞪眼

数据可视化图表总结(二)

Leetcode-6108: decrypt messages
![[2021]IBRNet: Learning Multi-View Image-Based Rendering Qianqian](/img/f1/e7a8a1a31bc5712d9f32d91305a2b0.jpg)
[2021]IBRNet: Learning Multi-View Image-Based Rendering Qianqian
随机推荐
Real time clock (RTC)
2021apmcm post game Summary - edge detection
什么是套接字?Socket基本介绍
做 SQL 性能优化真是让人干瞪眼
1040 Longest Symmetric String
LeetCode 1200. Minimum absolute difference
4. Object mapping Mapster
博弈论 AcWing 894. 拆分-Nim游戏
In depth analysis of for (VaR I = 0; I < 5; i++) {settimeout (() => console.log (I), 1000)}
LVS简介【暂未完成(半成品)】
【LeetCode】Day94-重塑矩阵
【Rust 笔记】16-输入与输出(上)
LeetCode 0107. Sequence traversal of binary tree II - another method
Leetcode-6109: number of people who know secrets
【Rust 笔记】15-字符串与文本(上)
MySQL advanced part 1: stored procedures and functions
Is it impossible for lamda to wake up?
MySQL advanced part 2: optimizing SQL steps
C - XOR to all (binary topic)
MySQL advanced part 2: SQL optimization