当前位置:网站首页>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;
}
边栏推荐
- [rust notes] 17 concurrent (Part 1)
- New title of module a of "PanYun Cup" secondary vocational network security skills competition
- 1041 Be Unique
- Sqlmap tutorial (II) practical skills I
- What's wrong with this paragraph that doesn't work? (unresolved)
- Liunx starts redis
- 【LeetCode】Day95-有效的数独&矩阵置零
- 栈 AcWing 3302. 表达式求值
- 开源存储这么香,为何我们还要坚持自研?
- [BMZCTF-pwn] ectf-2014 seddit
猜你喜欢
Navicat連接Oracle數據庫報錯ORA-28547或ORA-03135
SPI details
liunx启动redis
2021apmcm post game Summary - edge detection
MySQL advanced part 2: MySQL architecture
Network security skills competition in Secondary Vocational Schools -- a tutorial article on middleware penetration testing in Guangxi regional competition
Erreur de connexion Navicat à la base de données Oracle Ora - 28547 ou Ora - 03135
QQ电脑版取消转义符输入表情
[2021]IBRNet: Learning Multi-View Image-Based Rendering Qianqian
MySQL advanced part 2: SQL optimization
随机推荐
Redis publish subscribe command line implementation
【Rust 笔记】17-并发(上)
Record the process of configuring nccl and horovod in these two days (original)
【Rust 笔记】14-集合(上)
[2021]IBRNet: Learning Multi-View Image-Based Rendering Qianqian
Navicat连接Oracle数据库报错ORA-28547或ORA-03135
Chart. JS - Format Y axis - chart js - Formatting Y axis
Winter vacation water test 1 Summary
One question per day 1020 Number of enclaves
[BMZCTF-pwn] ectf-2014 seddit
【Rust 笔记】17-并发(下)
New title of module a of "PanYun Cup" secondary vocational network security skills competition
Leetcode stack related
[rust notes] 14 set (Part 1)
Leetcode backtracking method
[rust notes] 17 concurrent (Part 2)
Records of some tools 2022
Spark中groupByKey() 和 reduceByKey() 和combineByKey()
Niu Mei's math problems
927. Trisection simulation