답안 #162214

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
162214 2019-11-07T04:58:01 Z crisente235 수족관 1 (KOI13_aqua1) C++14
컴파일 오류
0 ms 0 KB
#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;
}

Compilation message

aqua1.cpp: In function 'int main()':
aqua1.cpp:13:2: error: 'memset' was not declared in this scope
  memset(aqua, -1, sizeof(aqua));
  ^~~~~~
aqua1.cpp:13:2: note: suggested alternative: 'wmemset'
  memset(aqua, -1, sizeof(aqua));
  ^~~~~~
  wmemset