/ GMQ OJ / 讨论 / 问答 /

1729???

#include <cstdio>
#include <algorithm>
using namespace std;
const int MAXN = 100001;
const int MAXM = 100001;
struct edge {
    int u, v, w;
    double val;
} edges[MAXM];
int a[MAXN];
int main() {
    int n, m;
    scanf("%d %d", &n, &m);
    for (int i = 1; i <= n; i++) {
        scanf("%d", &a[i]);
    }
    double maxval = 0;
    for (int i = 0; i < m; i++) {
        scanf("%d %d %d", &edges[i].u, &edges[i].v, &edges[i].w);
        edges[i].val = (a[edges[i].u] + a[edges[i].v]) * 1.0 / edges[i].w;
        maxval = max(maxval, edges[i].val);
    }
    printf("%.2lf", maxval);
    return 0;
}

为什么我的代码在BSOJ上过了,却无法在GMQOJ上过呢(MLE)

2 条评论

  • 1