daily pastebin goal
53%
SHARE
TWEET

Untitled

kostes Dec 13th, 2018 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2. #define pb push_back
  3. #define all(c) c.begin(),c.end()
  4. using namespace std;
  5. typedef long long ll;
  6. const ll INF64 = 1e18 + 1337;
  7. const int INF32 = 1e9 + 228;
  8. const int MOD = 1e9 + 7;
  9. #define ndbg 1
  10. int main()
  11. {
  12.     ios_base::sync_with_stdio(0);
  13. #ifdef ndbg
  14.   ifstream cin("input.txt");
  15.   ofstream cout("output.txt");
  16. #endif
  17.     cin.tie(0);cout.tie(0);
  18.  
  19.  
  20.     int n, a, b;
  21.     cin >> n >> a >> b;
  22.     int pos = a;
  23.     if(a < b)
  24.     {
  25.         if(b == a + 1 && b != n && a != 1) {cout << 0; return 0;}
  26.         for( ; pos >= 3; cout << -2 << "\n", pos -= 2);
  27.         if(pos != 1)
  28.         {
  29.             cout << -1 << "\n";
  30.             pos--;
  31.         }
  32.         else if(pos + 1 != b)
  33.         {
  34.             cout << 1 << "\n";
  35.             pos++;
  36.         }
  37.         for( ; pos <= a - 1; cout << 2 << "\n", pos += 2);
  38.         for( ; pos < b - 1; cout << 1 << "\n", pos++);
  39.         for( ; pos <= n - 2; cout << 2 << "\n", pos += 2);
  40.         if(pos != n)
  41.         {
  42.             cout << 1 << "\n";
  43.             pos++;
  44.         }
  45.         else if(pos != b)
  46.         {
  47.             cout << -1 << "\n";
  48.             pos--;
  49.         }
  50.         for( ; pos != b; cout << -2 << "\n", pos -= 2);
  51.     }
  52.     else
  53.     {
  54.         if(a == b + 1 && a != n && b != 1) {cout << 0; return 0;}
  55.         for( ; pos <= n - 2; cout << 2 << "\n", pos += 2);
  56.         if(pos != n)
  57.         {
  58.             cout << 1 << "\n";
  59.             pos++;
  60.         }
  61.         else if(pos - 1 != b)
  62.         {
  63.             cout << -1 << "\n";
  64.             pos--;
  65.         }
  66.         for( ; pos >= a + 1; cout << -2 << "\n", pos -= 2);
  67.         for( ; pos > b + 1; cout << -1 << "\n", pos--);
  68.         for( ; pos >= 3; cout << -2 << "\n", pos -= 2);
  69.         if(pos != 1)
  70.         {
  71.             cout << -1 << "\n";
  72.             pos--;
  73.         }
  74.         else if(pos != b)
  75.         {
  76.             cout << 1 << "\n";
  77.             pos++;
  78.         }
  79.         for( ; pos != b; cout << 2 << "\n", pos += 2);
  80.     }
  81.  
  82. #ifdef ndbg
  83.   cin.close();
  84.   cout.close();
  85. #endif
  86.     return 0;
  87. }
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