当前位置:网站首页>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;
}
边栏推荐
- [2020]GRAF: Generative Radiance Fields for 3D-Aware Image Synthesis
- Is it impossible for lamda to wake up?
- LVS简介【暂未完成(半成品)】
- QQ computer version cancels escape character input expression
- 开源存储这么香,为何我们还要坚持自研?
- [rust notes] 17 concurrent (Part 1)
- Groupbykey() and reducebykey() and combinebykey() in spark
- [rust notes] 14 set (Part 2)
- MIT-6874-Deep Learning in the Life Sciences Week 7
- Quickly use Amazon memorydb and build your own redis memory database
猜你喜欢
redis发布订阅命令行实现
Appium foundation - use the first demo of appium
容斥原理 AcWing 890. 能被整除的数
Navicat連接Oracle數據庫報錯ORA-28547或ORA-03135
Arduino 控制的 RGB LED 无限镜
Traditional databases are gradually "difficult to adapt", and cloud native databases stand out
Quickly use Amazon memorydb and build your own redis memory database
博弈论 AcWing 894. 拆分-Nim游戏
Spark中groupByKey() 和 reduceByKey() 和combineByKey()
4. Object mapping Mapster
随机推荐
Appium foundation - use the first demo of appium
MySQL advanced part 2: the use of indexes
背包问题 AcWing 9. 分组背包问题
One question per day 1020 Number of enclaves
Erreur de connexion Navicat à la base de données Oracle Ora - 28547 ou Ora - 03135
Usage scenarios of golang context
js快速将json数据转换为url参数
[leetcode] day95 effective Sudoku & matrix zeroing
[rust notes] 14 set (Part 1)
LeetCode-54
【Rust 笔记】14-集合(下)
一些工具的记录2022
MySQL advanced part 2: MySQL architecture
1041 Be Unique
Nested method, calculation attribute is not applicable, use methods
MySQL advanced part 1: stored procedures and functions
MySQL advanced part 2: storage engine
Shutter web hardware keyboard monitoring
Quickly use Amazon memorydb and build your own redis memory database
1039 Course List for Student