/******************************************************* * Copyright (C) 2015 Haotian Wu * * This file is the solution to the question: * https://www.hackerrank.com/challenges/cavity-map * * Redistribution and use in source and binary forms are permitted. *******************************************************/ #include #include #include #include #include #include using namespace std; char mp[100][101]; char out[100][101]; // Output map. We can get rid of this if we use a more fancy way to write... but this is more understandable. int main() { // OK. Simulation again. Watch out for edge checking. int n; scanf("%d",&n); for (int i=0;imp[i][j-1] && mp[i][j]>mp[i][j+1] && mp[i][j]>mp[i-1][j] && mp[i][j]>mp[i+1][j]) out[i][j] = 'X'; for (int i=0;i