fork(1) download
  1. //84104971101048411497 - Can you guess what does this mean?
  2. #include <message.h>
  3. #include <stdio.h>
  4. #include "oops.h"
  5.  
  6. #define MASTER_NODE 7
  7. #define DONE -2000000000000000008LL
  8. using namespace std;
  9. #include <bits/stdc++.h>
  10. #define mapii map<int, int>
  11. #define debug(a) cout << #a << ": " << a << endl
  12. #define debuga1(a, l, r) fto(i, l, r) cout << a[i] << " "; cout << endl
  13. #define fdto(i, r, l) for(int i = (r); i >= (l); --i)
  14. #define fto(i, l, r) for(int i = (l); i <= (r); ++i)
  15. #define ftoa(i, l, r, a) for(int i = (l); i <= (r); i += a)
  16. #define forit(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)
  17. #define fordit(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)
  18. #define ii pair<int, int>
  19. #define iii pair<int, ii>
  20. #define ff first
  21. #define ss second
  22. #define mp make_pair
  23. #define pb push_back
  24. #define ll long long
  25. #define maxN 13
  26. #define oo 2000000000000000007LL
  27.  
  28. template <class T>
  29. T min(T a, T b, T c) {
  30.   return min(a, min(b, c));
  31. }
  32.  
  33. template <class T>
  34. T max(T a, T b, T c) {
  35.   return max(a, max(b, c));
  36. }
  37.  
  38. int main() {
  39.   int N = GetN();
  40.   int nodes = NumberOfNodes();
  41.   int my_id = MyNodeId();
  42.  
  43.   ll maxX = -oo, minX = oo;
  44.   ftoa(j, my_id, N-1, nodes) {
  45.   maxX = max(maxX, GetNumber(j));
  46.   minX = max(minX, GetNumber(j));
  47.   }
  48. PutLL(MASTER_NODE, minX);
  49. PutLL(MASTER_NODE, maxX);
  50. PutLL(MASTER_NODE, DONE);
  51. Send(MASTER_NODE);
  52.  
  53. if (my_id == MASTER_NODE) {
  54.   ll maxX = -oo, minX = oo;
  55.   fto(node, 0, nodes-1) {
  56.   while (true) {
  57.   Receive(-1);
  58.   ll x = GetLL(node);
  59.   if (x == DONE) break;
  60.   else {
  61.   minX = min(minX, x);
  62.   maxX = max(maxX, x);
  63.   }
  64. }
  65. }
  66.  
  67. printf("%lld\n", maxX-minX);
  68. }
  69.  
  70. return 0;
  71. }
  72.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Free Pascal Compiler version 2.6.4+dfsg-6 [2015/05/31] for i386
Copyright (c) 1993-2014 by Florian Klaempfl and others
Target OS: Linux for i386
Compiling prog.pas
prog.pas(2,1) Error: Illegal char constant
prog.pas(2,2) Fatal: Syntax error, "BEGIN" expected but "const string" found
Fatal: Compilation aborted
Error: /usr/bin/ppc386 returned an error exitcode (normal if you did not specify a source file to be compiled)
stdout
Standard output is empty