#include using namespace std; #define modulo 1000000007 #define mod(mod_x) ((((long long)mod_x+modulo))%modulo) #define Inf 10000000000000000 vector> V1,V2,V3,V4; void dfs1(vector &a,vector &b,vector &c,int ind,long long love,long long money){ int n = a.size(); if(ind==n){ V1.emplace_back(money,love); return; } else if(ind==n+1){ V2.emplace_back(money,love); return; } dfs1(a,b,c,ind+1,love,money+a[ind]); if(ind!=n-1)dfs1(a,b,c,ind+2,love+b[ind+1],money-c[ind+1]); else dfs1(a,b,c,ind+2,love,money); } void dfs2(vector &a,vector &b,vector &c,int ind,long long love,long long money,bool f){ int n = a.size(); if(ind==n){ if(f)V3.emplace_back(money,love); else V4.emplace_back(money,love); return; } else if(ind==n+1){ return; } dfs2(a,b,c,ind+1,love,money+a[ind],f); if(ind!=n-1)dfs2(a,b,c,ind+2,love+b[ind+1],money-c[ind+1],f); else dfs2(a,b,c,ind+2,love,money,f); } int main(){ int D; cin>>D; vector a(D),b(D),c(D); for(int i=0;i>a[i]>>b[i]>>c[i]; } vector a1,a2,b1,b2,c1,c2; for(int i=0;i P = make_pair(0,-Inf); for(int i=0;i