Skip to content

Instantly share code, notes, and snippets.

@fredbr

fredbr/mitos.cpp Secret

Created June 6, 2018 23:10
Show Gist options
  • Save fredbr/51149061c1bdacf385e54918a591c039 to your computer and use it in GitHub Desktop.
Save fredbr/51149061c1bdacf385e54918a591c039 to your computer and use it in GitHub Desktop.
//solucao de Davi Gabriel
#include <bits/stdc++.h>
using namespace std;
const int MAXY = 505;
//Declaro MAXY sendo o valor máximo de x, y = 500
int mark[MAXY][MAXY]; //Crio a matriz dos nossos quadrantes
//Inicialmente cada posição dessa matriz é 0
int main() {
int n, x, y;
cin >> n;
bool atingido = 0; //Nossa resposta sera "atingido" que retorna
//0 se for um mito e 1 se for verdade
for(int i = 0; i < n; i++){
cin >> x >> y; //Leio as coordenadas do quadrante atingido pelo raio
if(mark[x][y] == 0){ //Se nenhum raio tiver atingido este quadrante
mark[x][y] = 1; //Marco que ele foi atingido
}
else{ //Se ele já tiver sido atingido, então não é um mito
atingido = 1;
}
}
cout << atingido << "\n";
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment