Skip to content

Instantly share code, notes, and snippets.

@rogerioagjr
Created June 29, 2015 12:10
Show Gist options
  • Save rogerioagjr/b2e661659201f4c03c95 to your computer and use it in GitHub Desktop.
Save rogerioagjr/b2e661659201f4c03c95 to your computer and use it in GitHub Desktop.
Pulo do Sapo (Roger Benet)
#include <cstdio>
int pedras[110];
int n,m;
void busca (int ini,int fim,int d){
if(fim == n){
while(ini <= fim){
pedras[ini] = 1;
ini += d;
}
}
if(fim == 1) {
while(ini >= fim){
pedras[ini] = 1;
ini -= d;
}
}
}
int main(){
scanf("%d %d", &n, &m);
while(m-- > 0){
int p,dis;
scanf("%d %d", &p, &dis);
busca(p,n,dis);
busca(p,1,dis);
}
for(int i = 1; i <= n; i++)
printf("%d\n",pedras[i]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment