Submission #1170002

#TimeUsernameProblemLanguageResultExecution timeMemory
1170002anteknneNaan (JOI19_naan)C++20
0 / 100
0 ms324 KiB
#include<bits/stdc++.h>
using namespace std;

typedef long double ld;

const int MAXN = 2000;
const int MAXL = 2000;
const ld eps = 0.000000000000001;
int v[MAXN][MAXL];

void rozw1 (int n, int l) {
    ld suma0 = 0;
    ld suma1 = 0;
    for (int i = 0; i < l; i ++) {
        suma0 += v[0][i];
        suma1 += v[1][i];
    }

    suma0 /= 2.0;
    suma1 /= 2.0;

    ld akt = 0;
    int ind = -1;
    while (ind + 1 < l && ld(v[0][ind + 1]) + akt <= suma0) {
        akt += ld(v[0][ind + 1]);
        ind ++;
    }
    ind ++;

    suma0 *= 2.0;
    cout << suma0 - 2.0 * akt + ind * 2 * v[0][ind] << " " << 2 * v[0][ind] << "\n";
}

int main () {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int n, l;
    cin >> n >> l;
    for (int i = 0; i < n; i ++) {
        for (int j = 0; j < l; j ++) {
            cin >> v[i][j];
        }
    }

    if (n == 2) {
        rozw1(n, l);
    }



    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...