SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <algorithm>
  5.  
  6. using namespace std;
  7.  
  8. enum {
  9.     ENEMY=-1,
  10.     NEUTRAL=0,
  11.     ME=1
  12. };
  13.  
  14. struct Factory {
  15.     int id;
  16.     int owner;
  17.     int troopCount;
  18.     int production;
  19. }; 
  20.  
  21. struct Relation {
  22.     Factory factory1;
  23.     Factory factory2;
  24.     int distance;
  25. };
  26.  
  27. Relation minDistanceFromFactory(Factory, Relation*, bool);
  28.  
  29. int factoryCount;
  30. int linkCount;
  31. /**
  32.  * Auto-generated code below aims at helping you parse
  33.  * the standard input according to the problem statement.
  34.  **/
  35. int main()
  36. {
  37.      // the number of factories
  38.     cin >> factoryCount; cin.ignore();
  39.     // the number of links between factories
  40.     cin >> linkCount; cin.ignore();
  41.    
  42.     Factory factories[factoryCount];
  43.     Relation relations[linkCount];
  44.    
  45.     for (int i=0; i < factoryCount; i++) {
  46.         Factory factory;
  47.         factory.id = i;
  48.         factories[i] = factory;
  49.     }
  50.  
  51.     for (int i = 0; i < linkCount; i++) {
  52.         int factory1;
  53.         int factory2;
  54.         int distance;
  55.         cin >> factory1 >> factory2 >> distance; cin.ignore();
  56.         relations[i].factory1 = factories[factory1];
  57.         relations[i].factory2 = factories[factory2];
  58.         relations[i].distance = distance;
  59.     }
  60.  
  61.     // game loop
  62.     while (1) {
  63.         int entityCount; // the number of entities (e.g. factories and troops)
  64.         cin >> entityCount; cin.ignore();
  65.         for (int i = 0; i < entityCount; i++) {
  66.             int entityId;
  67.             string entityType;
  68.             int owner;
  69.             int arg2;
  70.             int arg3;
  71.             int arg4;
  72.             int arg5;
  73.             cin >> entityId >> entityType >> owner >> arg2 >> arg3 >> arg4 >> arg5; cin.ignore();
  74.             if (entityType == "FACTORY") {
  75.                 factories[entityId].owner = owner;
  76.                 factories[entityId].troopCount = arg2;
  77.                 factories[entityId].production = arg3;
  78.             }
  79.         }
  80.         int source = -1;
  81.         int destination;
  82.         int cyborgs;
  83.         int distance = 999;
  84.         for(int i = 0; i < factoryCount; i++) {
  85.            
  86.         }
  87.         if (source != -1) {
  88.             cout << "MOVE " << source << " " << destination << " " << cyborgs << endl;
  89.         } else {
  90.             cout << "WAIT" << endl;
  91.         }
  92.        
  93.        
  94.  
  95.         // Write an action using cout. DON'T FORGET THE "<< endl"
  96.         // To debug: cerr << "Debug messages..." << endl;
  97.  
  98.  
  99.         // Any valid action, such as "WAIT" or "MOVE source destination cyborgs"
  100.     }
  101. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top