Cod sursa(job #3234328)

Utilizator Mihai_OctMihai Octavian Mihai_Oct Data 8 iunie 2024 19:54:39
Problema Oite Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.51 kb
#include <bits/stdc++.h>

using namespace std;

ifstream fin("oite.in");
ofstream fout("oite.out");
unordered_map<int, int> fr;
int n, l, i, j, a[1026], r;

int main() {
    ios_base::sync_with_stdio(false);
    fin.tie(nullptr);
    fout.tie(nullptr);

    fin >> n >> l;
    for(i = 1; i <= n; i++) fin >> a[i];

    for(i = 1; i <= n; i++) {
        for(j = i + 1; j <= n; j++) r += fr[l - a[i] - a[j]];
        for(j = 1; j < i; j++) fr[v[i] + v[j]]++;
    }
    fout << r;

    return 0;
}