daily pastebin goal
36%
SHARE
TWEET

Untitled

a guest Dec 16th, 2018 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <cmath>
  3. #include <map>
  4. #include <iomanip>
  5. #include <cmath>
  6. #include <iterator>
  7. #include <fstream>
  8. #include <string>
  9. #include <algorithm>
  10. #include <set>
  11. #include <vector>
  12. #include <valarray>
  13. #include <queue>
  14. #define INF 1e18
  15. //#include<bits/stdc++.h>
  16. using namespace std;
  17.  
  18. int main()
  19. {
  20.     //freopen("bfs.in", "r", stdin);
  21.     //freopen("bfs.out", "w", stdout);
  22.     ios_base::sync_with_stdio(false);
  23.     cin.tie(NULL);
  24.     int n,k,x,j;
  25.     cin >>n;
  26.     if (n==1)
  27.     {
  28.         cout <<1;
  29.         return 0;
  30.     }
  31.     vector<int>old,newfag;
  32.     for (int i=0;i<n;i++)
  33.     old.push_back(i+1);
  34.     k=n/2;
  35.     while (k>0)
  36.     {
  37.         j=0;
  38.         for (int i=0;i<k;i++)
  39.         {
  40.             cin >>x;
  41.             if (x==1)newfag.push_back(old[j]);
  42.             else newfag.push_back(old[j+1]);
  43.             j+=2;
  44.         }
  45.         old=newfag;
  46.         newfag.clear();
  47.         k/=2;
  48.     }
  49.     cout <<newfag[0];
  50.     //  system("pause");
  51.     return 0;
  52. }
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