You are viewing a single comment's thread. Return to all comments →
only 4/9 test cases passed , can any one identify bug.
using namespace std; int main() { int arr[6][6] ; int t=6; while(t--) { for(int i=0; i<6; i++) cin>>arr[6-t][i]; } vectorv; int n=6; for(int i= 0; i<4;i++) for(int j= 0; j<4; j++) { int sum=0; sum = (arr[i][j] + arr[i][j+1] + arr[i][j+2] + arr[i+1][j+1] + arr[i+2][j] + arr[i+2][j+1] + arr[i+2][j+2]); v.push_back(sum); } int max = *max_element(v.begin(), v.end()); cout<
2D Array - DS
You are viewing a single comment's thread. Return to all comments →
only 4/9 test cases passed , can any one identify bug.
include
using namespace std; int main() { int arr[6][6] ; int t=6; while(t--) { for(int i=0; i<6; i++) cin>>arr[6-t][i]; } vectorv; int n=6; for(int i= 0; i<4;i++) for(int j= 0; j<4; j++) { int sum=0; sum = (arr[i][j] + arr[i][j+1] + arr[i][j+2] + arr[i+1][j+1] + arr[i+2][j] + arr[i+2][j+1] + arr[i+2][j+2]); v.push_back(sum); } int max = *max_element(v.begin(), v.end()); cout<