#include "kanapka.h"
#include "message.h"
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
// if(MyNodeId()!=0) return 0;
int id=MyNodeId();
long long n=GetN();
//if(id==0) cout<<n<<" "<<NumberOfNodes();
if(id==0)
{
long long wyn=0;
long long sum=0;
long long mpref=0;
for(int i=0; i<n; i++)
{
sum+=GetTaste(i);
wyn=min(wyn, sum-mpref);
mpref=max(mpref, sum);
}
cout<<sum-wyn;
}
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | #include "kanapka.h" #include "message.h" #include <algorithm> #include <iostream> using namespace std; int main() { // if(MyNodeId()!=0) return 0; int id=MyNodeId(); long long n=GetN(); //if(id==0) cout<<n<<" "<<NumberOfNodes(); if(id==0) { long long wyn=0; long long sum=0; long long mpref=0; for(int i=0; i<n; i++) { sum+=GetTaste(i); wyn=min(wyn, sum-mpref); mpref=max(mpref, sum); } cout<<sum-wyn; } } |
English