#include <vector> #include <iostream> #include "krazki.h" #include "message.h" #define ull unsigned long long using namespace std; ull n,m,x,d,zero=0; int main() { if(MyNodeId()==0){ n=PipeHeight(); m=NumberOfDiscs(); vector<ull> w(n, 0); w[0]=HoleDiameter(0); for (int i = 1; i < n; i++) { w[i]=HoleDiameter(i); w[i] = min(w[i], w[i-1]); } d=n; for (int i = 1; i <= m; i++) { x=DiscDiameter(i); while (d>0 && w[d-1]<x) d--; d--; } cout<<max(zero,d+1); } 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 | #include <vector> #include <iostream> #include "krazki.h" #include "message.h" #define ull unsigned long long using namespace std; ull n,m,x,d,zero=0; int main() { if(MyNodeId()==0){ n=PipeHeight(); m=NumberOfDiscs(); vector<ull> w(n, 0); w[0]=HoleDiameter(0); for (int i = 1; i < n; i++) { w[i]=HoleDiameter(i); w[i] = min(w[i], w[i-1]); } d=n; for (int i = 1; i <= m; i++) { x=DiscDiameter(i); while (d>0 && w[d-1]<x) d--; d--; } cout<<max(zero,d+1); } return 0; } |