# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
162214 | crisente235 | 수족관 1 (KOI13_aqua1) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<iostream>
#include<iomanip>
using namespace std;
int aqua[5000][5000];
int main() {
int edge;
int x1, y1,x2,y2;
int hole;
int cnt=0;
memset(aqua, -1, sizeof(aqua));
cin >> edge;
cin >> x1 >> y1;
for (int a = 0; a < (edge-2)/2; a++) {
cin >> x1 >> y1;
cin>> x2 >> y2;
for (int i = 0; i < y2; i++) {
if ((x2 - x1) > 1) {
aqua[i][x1] = 1;
aqua[i][x1+1] = 1;
cnt+=2;
}
else {
aqua[i][x1] = 1;
cnt++;
}
}
}
cin >> x1 >> y1;
cin >> hole;
for (int i = 0; i < hole; i++) {
cin >> x1 >> y1 >> x2 >> y2;
for (int y = 0; y < y1; y++) {
for (int x = 0; x < ((edge) / 2)+1; x++) {
if (aqua[y][x] == -1) {
break;
}
else if(aqua[y][x]==0){
}
else {
aqua[y][x] = 0;
cnt--;
}
}
}
}
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
cout <<setw(5)<<aqua[i][j];
}
cout << "\n";
}
cout << cnt;
return 0;
}