|  | 
|  | 
| | I wrote the solution and had the correct answers on test cases, but i have wa1. Can someone help me or give advice?
 This is my solution:
 
 #include <iostream>
 #include <iomanip>
 #include <cmath>
 #include <algorithm>
 #include <numeric>
 #include <set>
 #include <map>
 #include <vector>
 #include <string>
 #include <cstring>
 #include <cstdlib>
 
 using namespace std;
 #define task
 
 
 void print(int array[], int n) {
 for (int i = 0; i < n; i++) {
 cout << array[i] << ' ';
 }
 }
 
 void optimization() {
 cin.tie(nullptr);
 ios_base::sync_with_stdio(false);
 }
 
 int factorial(int x) {
 int a = 1;
 for (int i = 2; i < x + 1; i++) {
 a *= i;
 }
 return a;
 }
 
 
 #ifdef task
 
 int main() {
 optimization();
 
 int n, m;
 cin >> n >> m;
 int **field = new int *[n];
 for (int i = 0; i < n; i++) {
 field[i] = new int[m];
 }
 
 for (int i = 0; i < n; i++) {
 for (int j = 0; j < m; j++) {
 cin >> field[i][j];
 }
 }
 int q;
 int k;
 int x = 0; int y = 0;
 int max_drop = -1;
 int part_sum = 0;
 int move_to_right = -1;
 cin >> q;
 for (int quest = 0; quest < q; quest++) {
 cin >> k;
 for (int i = 0; i < n; i++) {
 for (int j = 0; j < m; j++) {
 move_to_right = k + 1;
 part_sum = 0;
 for (int down = i; down < i + k + 1; down++) {
 for (int right = j; right < j + move_to_right; right++) {
 if (down < n && right < m) {
 part_sum += field[down][right];
 }
 }
 move_to_right--;
 }
 
 if (part_sum > max_drop) {
 max_drop = part_sum;
 x = i + 1;
 y = j + 1;
 }
 }
 }
 
 cout << max_drop << ' ' << x << ' ' << y << endl;
 max_drop = -1;
 
 }
 
 return 0;
 }
 
 #endif
 upd:Before I used scanf and got wa1. Now with cin // cout i have tle17.
I thought my solution is quite "brute", are there any other solutions?And I have to say it is a really good problem for sufficient samples and a clear statement.
 And where is your solution?sentenсe "for which x0 ≤ x, y0 ≤ y (as in the game the southeast wind blows)" looks like x0 <= x <= y and x0 <= y0 <=y but in fact it should be x0 <= x and y0 <= y Thank you for your comment. Problem statement was fixed. | 
 | 
|