#include <bits/stdc++.h> #include "message.h" #include "krazki.h" #define double long double #define LL long long #define MP make_pair #define ST first #define ND second #define PII pair<LL,LL > #define PPIII pair<PII,int> #define PPIIPII pair<PII,PII> #define PIB pair<int,bool> #define PIS pair<int,string> #define PB push_back #define VI vector<LL> #define VVI vector<VI> #define VLL vector<long long> #define VVLL vector<VLL> #define VB vector<bool> #define VPII vector<PII> #define VPPIII vector<PPIII> #define VPPIIPII vector<PPIIPII> #define VPIB vector<PIB> #define VPIS vector<PIS> #define SI set<int> #define SPII set<PPIII> #define VS vector<string> #define PB push_back #define INF (LL) 1000000000000000000 #define MOD 2000007 #define ALL(c) c.begin(),c.end() #define NWD __gcd #define SIZE 1000000 using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); if(MyNodeId() != 0) return EXIT_SUCCESS; LL w=PipeHeight(); LL zap=NumberOfDiscs(); vector<LL>szer; LL pocz=INF, Id = MyNodeId(); for(LL i=0;i<w;i++) { szer.PB(HoleDiameter(i)); if(i) szer[i] =min(szer[i], szer[i-1]); } LL wys=w-1; pocz=0; while(true) { if(pocz == zap) { cout<<wys<<endl; return EXIT_SUCCESS; } LL kr = DiscDiameter(pocz); while(wys >=0 and szer[wys] < kr) wys--; if(wys==-1) { cout<<0<<endl; return EXIT_SUCCESS; } wys--; pocz++; } return EXIT_SUCCESS; }
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 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | #include <bits/stdc++.h> #include "message.h" #include "krazki.h" #define double long double #define LL long long #define MP make_pair #define ST first #define ND second #define PII pair<LL,LL > #define PPIII pair<PII,int> #define PPIIPII pair<PII,PII> #define PIB pair<int,bool> #define PIS pair<int,string> #define PB push_back #define VI vector<LL> #define VVI vector<VI> #define VLL vector<long long> #define VVLL vector<VLL> #define VB vector<bool> #define VPII vector<PII> #define VPPIII vector<PPIII> #define VPPIIPII vector<PPIIPII> #define VPIB vector<PIB> #define VPIS vector<PIS> #define SI set<int> #define SPII set<PPIII> #define VS vector<string> #define PB push_back #define INF (LL) 1000000000000000000 #define MOD 2000007 #define ALL(c) c.begin(),c.end() #define NWD __gcd #define SIZE 1000000 using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); if(MyNodeId() != 0) return EXIT_SUCCESS; LL w=PipeHeight(); LL zap=NumberOfDiscs(); vector<LL>szer; LL pocz=INF, Id = MyNodeId(); for(LL i=0;i<w;i++) { szer.PB(HoleDiameter(i)); if(i) szer[i] =min(szer[i], szer[i-1]); } LL wys=w-1; pocz=0; while(true) { if(pocz == zap) { cout<<wys<<endl; return EXIT_SUCCESS; } LL kr = DiscDiameter(pocz); while(wys >=0 and szer[wys] < kr) wys--; if(wys==-1) { cout<<0<<endl; return EXIT_SUCCESS; } wys--; pocz++; } return EXIT_SUCCESS; } |