Tot iau 84p, desi am verificat toate testele comisiei. Aveti vreo idee despre ce poate cauza asta?
Uitati sursa:
#include <fstream>
#include <algorithm>
std::ifstream f("betasah.in");
std::ofstream g("betasah.out");
#define MAX 1000
#define Dmax 100
int N, D, K;
int M, P;
char mat[MAX + 2][MAX + 2];
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {1, -1, -1, 1, 0, 0, 1, -1};
int X[Dmax];
int Y[Dmax];
int ran[MAX + 2];
int main() {
f >> N >> D >> K;
for(int i = 0;i <= N + 1;i++)
mat
for(int i = 0;i <= N + 1;i++)
mat[i + 1] = 1, ran = i;
for(int i = 0;i < D;i++) {
f >> X >> Y;
int x = X, y = Y;
mat }
for(int i = 0;i < K;i++) {
int x, y;
f >> x >> y;
mat ran }
for(int i = 1;i <= N;i++) {
M = std::max(M, ran);
}
g << M << std::endl;
for(int i = 0;i < D;i++) {
int x = X, y = Y;
for(int j = 0;j < 8;j++) {
x = X, y = Y;
int xx = dx[j], yy = dy[j];
while(mat[x + xx][y + yy] != 2 && x + xx >= y + yy && x + xx >= 1 && y + yy >= 1 && x + xx >= 1 && x + xx <= N) {
if(!mat[x + xx][y + yy])P++;
x += xx, y += yy;
mat- [y] = 1;// printf("%d %d\n", x, y);
// printf("%d %d %d\n", mat }
}
}
g << P << std::endl;
f.close();
g.close();
return 0;
}