#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <set>
#include <vector>
#include "krazki.h"
#include "message.h"
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define ST first
#define ND second
#define MP make_pair
#define PB push_back
typedef vector<int> VI;
typedef pair<int, int> PI;
typedef vector<PI> VPII;
typedef set<int> SI;
typedef long long LL;
typedef vector<LL> VLL;
const LL IN = 1000 * 1000 * 1000;
const LL INF = IN * IN;
// VLL zabl;
LL zabl;
// int przelecMnie(int r) {
// REP(i, v.size()) {
// if(v[i] < r)
// }
// return -1;
// }
int main() {
int n = NumberOfDiscs();
int m = PipeHeight();
zabl = m+1;
int myId = MyNodeId();
int nodesNr = NumberOfNodes();
if (myId != 0)
return 0;
int depth;
// long long int max_disc_diameter = 0;
int j;
LL cur_disk, cur_width;
for (int i = 1; i <= NumberOfDiscs(); i++) {
cur_disk = DiscDiameter(i);
// cout << i << " " << cur_disk << ": " ;
for (j = 1; j < zabl; j++) {
cur_width = HoleDiameter(j);
// cout << j << " " << cur_width << "\n";
if(cur_disk > cur_width) {
zabl = j-1;
break;
}
}
if(j == zabl)
zabl = j-1;
}
// cout << "\n";
depth = min((LL)j, zabl);
cout << depth << "\n";
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 | #include <algorithm> #include <cstdio> #include <cstdlib> #include <iostream> #include <map> #include <set> #include <vector> #include "krazki.h" #include "message.h" using namespace std; #define REP(i, n) for (int i = 0; i < (int)n; i++) #define ST first #define ND second #define MP make_pair #define PB push_back typedef vector<int> VI; typedef pair<int, int> PI; typedef vector<PI> VPII; typedef set<int> SI; typedef long long LL; typedef vector<LL> VLL; const LL IN = 1000 * 1000 * 1000; const LL INF = IN * IN; // VLL zabl; LL zabl; // int przelecMnie(int r) { // REP(i, v.size()) { // if(v[i] < r) // } // return -1; // } int main() { int n = NumberOfDiscs(); int m = PipeHeight(); zabl = m+1; int myId = MyNodeId(); int nodesNr = NumberOfNodes(); if (myId != 0) return 0; int depth; // long long int max_disc_diameter = 0; int j; LL cur_disk, cur_width; for (int i = 1; i <= NumberOfDiscs(); i++) { cur_disk = DiscDiameter(i); // cout << i << " " << cur_disk << ": " ; for (j = 1; j < zabl; j++) { cur_width = HoleDiameter(j); // cout << j << " " << cur_width << "\n"; if(cur_disk > cur_width) { zabl = j-1; break; } } if(j == zabl) zabl = j-1; } // cout << "\n"; depth = min((LL)j, zabl); cout << depth << "\n"; return EXIT_SUCCESS; } |
English