Advertisement
jakaria_hossain

codeforces - even picture

Jun 19th, 2020
1,243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define pii pair<int , int>
  5. #define fast()(ios_base::sync_with_stdio(0),cin.tie(NULL));
  6. int main()
  7. {
  8.     fast()
  9.     int n;
  10.     cin>>n;
  11.     int x[]={1,-1,0,0};
  12.     int y[]={0,0,1,-1};
  13.     int x_ord=1,y_ord=1;
  14.     set<pii>v;
  15.     v.insert(make_pair(0,0));
  16.     while(n--)
  17.     {
  18.         v.insert(make_pair(x_ord,y_ord));
  19.         for(int i=0;i<4;i++)v.insert(make_pair(x_ord+x[i],y[i]+y_ord));
  20.         x_ord++,y_ord++;
  21.     }
  22.     v.insert(make_pair(x_ord,y_ord));
  23.     cout<<v.size()<<endl;
  24.     for(auto x: v)
  25.     {
  26.         cout<<x.first<<" "<<x.second<<endl;
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement