#include #include #include #include #include #include using namespace std; //pair PP; vector< pair< int , pair > > vban,zban; int BAD[210][210]; vector > P; int N; queue Q; int dx[4] = {0,0,-1,1}; int dy[4] = {-1,1,0,0}; void bfs(int sx,int sy){ while(!Q.empty()) Q.pop(); Q.push(sx); Q.push(sy); while (!Q.empty()){ int px = Q.front(); Q.pop(); int py = Q.front(); Q.pop(); // (px == 105 && py == 105) cout << "tu" << endl; for (int i=0;i<4;i++){ int tx = px + dx[i]; int ty = py + dy[i]; if (tx < 0 || tx > 202) continue; if (ty < 0 || ty > 202) continue; if (BAD[tx][ty] != 0) continue; if (i > 1){ //vodorovne bany if (i == 2){ int wrong = 0; for(int j=0;j= vban[j].second.first && ty < vban[j].second.second ){ wrong = 1; break;} } } if (wrong == 1) continue; }else{ int wrong = 0; for(int j=0;j= vban[j].second.first && ty < vban[j].second.second ){ wrong = 1; break;} } } if (wrong == 1) continue; } }else{ //zvisle bany if ( i == 0){ int wrong = 0; for(int j=0;j= zban[j].second.first && tx < zban[j].second.second ){ wrong = 1; break;} } } if (wrong == 1) continue; }else{ int wrong = 0; for(int j=0;j= zban[j].second.first && tx < zban[j].second.second ){ wrong = 1; break;} } } if (wrong == 1) continue; } } BAD[tx][ty] = 1; Q.push(tx); Q.push(ty); } } return; } int main(){ while (true){ cin >> N; if (N == 0) break; P.resize(N); for (int i=0;i> x >> y; x+= 102; y+= 102; P[i] = make_pair(x,y); } vban.resize(0); zban.resize(0); memset(BAD,0,sizeof(BAD)); for (int i=0;i dolny, horny; if (P[i].second < P[(i+1)%N].second ){ dolny = P[i]; horny = P[(i+1)%N]; }else{ dolny = P[(i+1)%N]; horny = P[i]; } double delta = ( (double)(horny.first - dolny.first)/( horny.second - dolny.second )); double start = dolny.first; if (delta > 0.0){ for(int j = dolny.second; j