artemgf

Логи соревнований

Apr 15th, 2017
612
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.08 KB | None | 0 0
  1. #define _USE_MATH_DEFINES
  2. #include <iostream>
  3. #include <conio.h>
  4. #include <string>
  5. #include <set>
  6. #include <map>
  7. #include <algorithm>
  8. #include <string>
  9. #include <math.h>
  10. #include <vector>
  11. #include <cmath>
  12.  
  13. using namespace std;
  14.  
  15. struct compedit
  16. {
  17.     string name;
  18.     map <char, set <string>> result;
  19.     int sc;
  20.     string data;
  21. };
  22.  
  23. void build(compedit compedits)
  24. {
  25.     cout << "|";
  26.     cout << compedits.name;
  27.     for (int i = 1; i <= 30 - compedits.name.size(); i++)
  28.         cout << " ";
  29.     cout << "|";
  30.     cout << compedits.data;
  31.     cout << "|";
  32.     for (int i = 0; i <= compedits.sc - 1; i++)
  33.     {
  34.         char prom = 65 + i;
  35.         if (compedits.result.find(prom) != compedits.result.end())
  36.             if (compedits.result[prom].find(" Accepted") != compedits.result[prom].end())
  37.                 cout << "o";
  38.             else
  39.                 cout << "x";
  40.         else
  41.             cout << ".";
  42.     }
  43.     for (int i = 1; i <= 13- compedits.sc; i++)
  44.         cout << " ";
  45.     cout << "|" << endl;
  46.     cout << "+------------------------------+--------+-------------+" << endl;
  47. }
  48.  
  49. void start()
  50. {
  51.     cout << "+------------------------------+--------+-------------+" << endl;
  52.     cout << "|";
  53.     cout << "Contest name                  ";
  54.     cout << "|";
  55.     cout << "Date    ";
  56.     cout << "|";
  57.     cout << "ABCDEFGHIJKLM";
  58.     cout << "|" << endl;
  59.     cout << "+------------------------------+--------+-------------+" << endl;
  60. }
  61.  
  62. int main()
  63. {
  64.     int n;
  65.     compedit compedits[101];
  66.     int prom;
  67.  
  68.     cin >> n;
  69.  
  70.     getline(cin, compedits[0].name);
  71.  
  72.     for (int i = 1; i <= n; i++)
  73.     {
  74.         if(prom==0)
  75.             getline(cin, compedits[0].name);
  76.         getline(cin, compedits[i].name);
  77.         getline(cin, compedits[i].data);
  78.         cin >> compedits[i].sc;
  79.         cin >> prom;
  80.         for (int j = 1; j <= prom; j++)
  81.         {
  82.             string res;
  83.             char exc;
  84.             cin >> exc;
  85.             getline(cin, res);
  86.             if (compedits[i].result.find(exc) != compedits[i].result.end())
  87.                 compedits[i].result[exc].insert(res);
  88.             else
  89.             {
  90.                 set <string> prom2;
  91.                 prom2.insert(res);
  92.                 compedits[i].result.insert(pair<char, set <string>>(exc,prom2));
  93.             }
  94.         }
  95.     }
  96.  
  97.     start();
  98.     for (int i = 1; i <= n; i++)
  99.         build(compedits[i]);
  100.  
  101.     system("pause");
  102.     return 0;
  103. }
Advertisement
Add Comment
Please, Sign In to add comment