lucacodorean

Untitled

Oct 24th, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.05 KB | None | 0 0
  1. #include <fstream>
  2. #include <iostream>
  3. #include <cstring>
  4. #include <queue>
  5. #include <iomanip>
  6. #define MAX 10
  7. #define maxt 8
  8. using namespace std;
  9.  
  10. ifstream fin("sah.in");
  11. ofstream fout("sah.out");
  12.  
  13. int di[8]= {-1,0,1,0,-1,-1,+1,+1};
  14. int dj[8]= {0,1,0,-1,-1,+1,+1,-1};
  15. int a[MAX][MAX];
  16. int n;
  17. queue<pair<int, int> >q;
  18.  
  19. void gard()
  20. {
  21.     for(int i=0; i<=maxt+1; i++)
  22.     {
  23.         a[i][maxt+1]=-5;
  24.         a[i][0]=-5;
  25.     }
  26.     for(int j=0; j<=maxt+1; j++)
  27.     {
  28.         a[maxt+1][j]=-5;
  29.         a[0][j]=-5;
  30.     }
  31. }
  32.  
  33. int main ()
  34. {
  35.     int r,x,y;
  36.     fin>>n>>r;
  37.     memset(a,0,sizeof(a));
  38.     gard();
  39.     for(int i=1; i<=r; i++)
  40.     {
  41.         fin>>x>>y;
  42.         a[x][y]=-1;
  43.         q.push({x,y});
  44.     }
  45.     for(int i=1; i<=n-r; i++)
  46.     {
  47.         fin>>x>>y;
  48.         a[x][y]=-2;
  49.         q.push({x,y});
  50.     }
  51.     for(int i=0; i<=maxt+1; i++)
  52.     {
  53.         for(int j=0; j<=maxt+1; j++)
  54.         {
  55.             fout<<setw(2)<<a[i][j]<<" ";
  56.         }
  57.         fout<<endl;
  58.     }
  59.     fin.close();
  60.     fout.close();
  61.     return 0;
  62. }
Advertisement
Add Comment
Please, Sign In to add comment