func_code_string: #include <bits/stdc++.h>   struct T {     int l, h, a;     void scan() { scanf( %d%d%d , &l, &h, &a); }   };   const int INF = 1e9;   T Map[6][6];   int F[6];   int minF, maxC;   int cost;   int N;   void check() {     for (int i = 1; i < N - 1; ++i) {       if (F[i] != 0) return;     }     if (F[N - 1] < minF || F[N - 1] == minF && cost > maxC) {       minF = F[N - 1];       maxC = cost;     }   }   void rec(int from, int to) {     if (F[0] < INF - minF) return;     if (from == N - 1 && to == N) {       check();     }     if (from - 1 > 0 && F[from - 1] > 0) return;     int nextF, nextT;     nextT = to == N - 1 ? from + 2 : to + 1;     nextF = to == N - 1 ? from + 1 : from;     for (int i = Map[from][to].l; i <= Map[from][to].h && i <= F[from]; ++i) {       int d;       if (i == 0)         d = 0;       else {         d = Map[from][to].a + i * i;       }       cost += d;       F[from] -= i;       F[to] += i;       rec(nextF, nextT);       cost -= d;       F[from] += i;       F[to] -= i;     }   }   int main() {     scanf( %d , &N);     F[0] = INF;     for (int i = 0; i < N * (N - 1) / 2; ++i) {       int from, to;       scanf( %d%d , &from, &to);       --from;       --to;       Map[from][to].scan();     }     minF = INF;     maxC = -1;     cost = 0;     rec(0, 1);     if (minF == INF) {       printf( -1 -1 );       return 0;     }     printf( %d %d , minF, maxC);     return 0;   }   