Bzoj 4004 [JLOI2015] equipment purchase pseudo matrix + maximal linear Independent Group

Source: Internet
Author: User
link : Method: Quasi- matrix + maximal linear Independent group Resolution: above This problem is the elimination of the part of the change just a bit. It turns out that the 01 string is now fading matrix. Code:
#include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <
Algorithm> #define N 510 #define EPS 1e-5 using namespace std;
int n,m;
    struct Node {double z[n];
Double cost;
}a[n];
int b[n];
    int cmp (node X,node y) {return x.cost<y.cost;} int main () {scanf ("%d%d", &n,&m);
        for (int i=1;i<=n;i++) {for (int j=1;j<=m;j++) {scanf ("%lf", &a[i].z[j]);
    for (int i=1;i<=n;i++) scanf ("%lf", &a[i].cost);
    Sort (a+1,a+n+1,cmp);
    int cnt=0;
    Double ans=0;
            for (int i=1;i<=n;i++) {for (int j=1;j<=m;j++) {if (Fabs (a[i].z[j)) >eps)
                    {if (!b[j]) {b[j]=i;
                Break
                    }else {double rate=a[i].z[j]/a[b[j]].z[j];
    for (int k=1;k<=m;k++) {                    A[I].Z[K]-=RATE*A[B[J]].Z[K];
        '}} ' int flag=0;
        for (int j=1;j<=m;j++) {if (Fabs (a[i].z[j)) >eps) {flag=1;break;}
    } if (flag) cnt++,ans+=a[i].cost;
printf ("%d%.0lf\n", Cnt,ans); }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.