#include "kanapka.h"
#include "message.h"
#include <iostream>
using namespace std;
int N;
int maxL=0, maxR=0;
int main(){
ios_base::sync_with_stdio(0);
//N=GetN_LargeSample();
N=GetN();
int tmpL=0, tmpR=0;
for (int i=0; i<N/2; i++){
//tmpL+=GetTaste_LargeSample(i);
//tmpR+=GetTaste_LargeSample(N-i-1);
tmpL+=GetTaste(i);
tmpR+=GetTaste(N-i-1);
if (maxL<tmpL){
maxL=tmpL;
}
if (maxR<tmpR){
maxR=tmpR;
}
}
if (N%2){
//tmpL+=GetTaste_LargeSample(N/2);
tmpL+=GetTaste(N/2);
if (maxL<tmpL){
maxL=tmpL;
}
}
if (MyNodeId()==0){
cout<<maxL+maxR<<endl;
}
//cout<<maxL<<" "<<maxR<<endl;
return 0;
}
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | #include "kanapka.h" #include "message.h" #include <iostream> using namespace std; int N; int maxL=0, maxR=0; int main(){ ios_base::sync_with_stdio(0); //N=GetN_LargeSample(); N=GetN(); int tmpL=0, tmpR=0; for (int i=0; i<N/2; i++){ //tmpL+=GetTaste_LargeSample(i); //tmpR+=GetTaste_LargeSample(N-i-1); tmpL+=GetTaste(i); tmpR+=GetTaste(N-i-1); if (maxL<tmpL){ maxL=tmpL; } if (maxR<tmpR){ maxR=tmpR; } } if (N%2){ //tmpL+=GetTaste_LargeSample(N/2); tmpL+=GetTaste(N/2); if (maxL<tmpL){ maxL=tmpL; } } if (MyNodeId()==0){ cout<<maxL+maxR<<endl; } //cout<<maxL<<" "<<maxR<<endl; return 0; } |
English