vlatkovski

Books [jboi 2007] (UNFINISHED)

Jun 23rd, 2017
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.63 KB | None | 0 0
  1. //I was going somewhere, but I was going somewhere for so long that I got tired of this. May have been able to finish it if I'd given it a few more hours./s
  2.  
  3. #include <iostream> //cin, cout
  4. #include <set>
  5. #include <map>
  6. using namespace std;
  7.  
  8. struct p { int ij; int v; };
  9. typedef map<int, map<int, int>> bleh;
  10. typedef map<int, set<int>> ughh;
  11. typedef map<int, p> barf;
  12.  
  13. class Solution {
  14. private:
  15.     int N;
  16.     bleh m;
  17.     ughh mAvj; //val, {j}
  18.     ughh mBvi; //val, {i}
  19.     barf maxI; //i, {j, val}
  20.     barf maxJ; //j, {i, val}
  21.     int numInvisible = 0;
  22. public:
  23.     Solution(int n) : N(n) {
  24.         //get input
  25.         for (int i = 0; i < N; ++i) {
  26.             for (int j = 0; j < N; ++j) {
  27.                 int x; cin >> x;
  28.                 m[i][j] = x;
  29.                 mAvj[x].insert(j);
  30.                 mBvi[x].insert(i);
  31.                 if (maxI[i].v < x) { maxI[i] = {j, x}; }
  32.                 if (maxJ[j].v < x) { maxJ[j] = {i, x}; }
  33.             }
  34.         }
  35.  
  36.         //
  37.         int imaxprev = -1, jmaxprev = -1;
  38.         int imaxnext = -1, jmaxnext = -1;
  39.  
  40.         for (int i = 0; i < N; ++i) {
  41.             for (int j = 0; j < N; ++j) {
  42.                 int x = m[i][j];
  43.                 uggh::reverse_iterator irit = mAvj.begin();
  44.                 while ((*irit).first != x) { //the value of the last element of mAvj
  45.                     irit--;
  46.                 }
  47.             }
  48.         }
  49.     }
  50.     int getNumVisible() { return N - numInvisible; }
  51. };
  52.  
  53. int main() {
  54.     int N;
  55.     cin >> N;
  56.  
  57.     Solution solution(N);
  58.     int nvisible = solution.getNumVisible();
  59.  
  60.     cout << nvisible << endl;
  61.  
  62.     return 0;
  63. }
Advertisement
Add Comment
Please, Sign In to add comment