Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <iostream>
- #include <cstring>
- #include <queue>
- #include <iomanip>
- #define MAX 10
- #define maxt 8
- using namespace std;
- ifstream fin("sah.in");
- ofstream fout("sah.out");
- int di[8]= {-1,0,1,0,-1,-1,+1,+1};
- int dj[8]= {0,1,0,-1,-1,+1,+1,-1};
- int a[MAX][MAX];
- int n;
- queue<pair<int, int> >q;
- void gard()
- {
- for(int i=0; i<=maxt+1; i++)
- {
- a[i][maxt+1]=-5;
- a[i][0]=-5;
- }
- for(int j=0; j<=maxt+1; j++)
- {
- a[maxt+1][j]=-5;
- a[0][j]=-5;
- }
- }
- int main ()
- {
- int r,x,y;
- fin>>n>>r;
- memset(a,0,sizeof(a));
- gard();
- for(int i=1; i<=r; i++)
- {
- fin>>x>>y;
- a[x][y]=-1;
- q.push({x,y});
- }
- for(int i=1; i<=n-r; i++)
- {
- fin>>x>>y;
- a[x][y]=-2;
- q.push({x,y});
- }
- for(int i=0; i<=maxt+1; i++)
- {
- for(int j=0; j<=maxt+1; j++)
- {
- fout<<setw(2)<<a[i][j]<<" ";
- }
- fout<<endl;
- }
- fin.close();
- fout.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment