Unfortunately we were unable to fully decode your file, as it is not encoded in UTF-8.
You can try to decode it yourself by downloading it here.
// Micha� Figlus #include "maklib.h" #include "message.h" #include<cstdio> #include<cmath> #include<cstring> #include<cstdlib> #include<iostream> using namespace std; int main() { int a,k; long long N=Size(),i,b=0,l=0,c=0,p=0,sum=0; long long pocz=1+(MyNodeId()*N)/NumberOfNodes(),kon=1+(MyNodeId()*N+N)/NumberOfNodes(); for(i=pocz;i<kon;i++) { a=ElementAt(i); sum+=a; if(b>0) b+=a; else b=a; if(b>c) c=b; } if(b<0) b=0; p=b; b=0; for(i=kon-1;i>=pocz;i--) { a=ElementAt(i); if(b>0) b+=a; else b=a; } if(b<0) b=0; l=b; if(MyNodeId()>0) { PutLL(0,l); PutLL(0,c); PutLL(0,p); PutLL(0,sum); Send(0); } else { long long tl[100],tp[100],tsum[100],wynik; tl[0]=l; tp[0]=p; tsum[0]=sum; for(i=1;i<NumberOfNodes();i++) { k=Receive(-1); tl[k]=GetLL(k); b=GetLL(k); if(b>c) c=b; tp[k]=GetLL(k); tsum[k]=GetLL(k); } wynik=c; for(i=0;i<NumberOfNodes();i++) { if(tp[i]>wynik) wynik=tp[i]; for(k=i+1;k<NumberOfNodes();k++) { tp[i]+=tl[k]; if(tp[i]>wynik) wynik=tp[i]; tp[i]-=tl[k]; tp[i]+=tsum[k]; } } printf("%lld",wynik); } 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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | // Micha� Figlus #include "maklib.h" #include "message.h" #include<cstdio> #include<cmath> #include<cstring> #include<cstdlib> #include<iostream> using namespace std; int main() { int a,k; long long N=Size(),i,b=0,l=0,c=0,p=0,sum=0; long long pocz=1+(MyNodeId()*N)/NumberOfNodes(),kon=1+(MyNodeId()*N+N)/NumberOfNodes(); for(i=pocz;i<kon;i++) { a=ElementAt(i); sum+=a; if(b>0) b+=a; else b=a; if(b>c) c=b; } if(b<0) b=0; p=b; b=0; for(i=kon-1;i>=pocz;i--) { a=ElementAt(i); if(b>0) b+=a; else b=a; } if(b<0) b=0; l=b; if(MyNodeId()>0) { PutLL(0,l); PutLL(0,c); PutLL(0,p); PutLL(0,sum); Send(0); } else { long long tl[100],tp[100],tsum[100],wynik; tl[0]=l; tp[0]=p; tsum[0]=sum; for(i=1;i<NumberOfNodes();i++) { k=Receive(-1); tl[k]=GetLL(k); b=GetLL(k); if(b>c) c=b; tp[k]=GetLL(k); tsum[k]=GetLL(k); } wynik=c; for(i=0;i<NumberOfNodes();i++) { if(tp[i]>wynik) wynik=tp[i]; for(k=i+1;k<NumberOfNodes();k++) { tp[i]+=tl[k]; if(tp[i]>wynik) wynik=tp[i]; tp[i]-=tl[k]; tp[i]+=tsum[k]; } } printf("%lld",wynik); } return 0; } |