fork(28) download
  1. #include <iostream>
  2. #include <cstdio>
  3.  
  4. using namespace std;
  5. const int NMAX = 2014;
  6. long long d1[2*NMAX], d2[2*NMAX], sol[2];
  7. pair < int , int > v[2];
  8. int a[NMAX][NMAX];
  9. inline void Update(const int c,const int i,const int j,const long long val){
  10. if(val > sol[c]){
  11. sol[c] = val;
  12. v[c].first = i;
  13. v[c].second = j;
  14. }
  15. }
  16. int main(){
  17. #ifndef ONLINE_JUDGE
  18. freopen("date.in","r",stdin);
  19. freopen("date.out","w",stdout);
  20. #endif
  21. cin.sync_with_stdio(false);
  22. int n;
  23. cin >> n;
  24. sol[0] = sol[1] = -1;
  25. for(int i = 1;i <= n; ++i)
  26. for(int j = 1;j <= n; ++j){
  27. int x;
  28. cin >> a[i][j];
  29. d1[i+j] += a[i][j];
  30. d2[i-j+n] += a[i][j];
  31. }
  32. for(int i=1;i<=n;++i)
  33. for(int j=1;j<=n;++j)
  34. Update((i+j)&1,i,j,d1[i+j]+d2[i-j+n]-a[i][j]);
  35. cout<<sol[0]+sol[1]<<"\n";
  36. if(v[0] > v[1])
  37. swap(v[0],v[1]);
  38. cout<<v[0].first<<" "<<v[0].second<<" ";
  39. cout<<v[1].first<<" "<<v[1].second<<"\n";
  40. return 0;
  41. }
Success #stdin #stdout 0s 19344KB
stdin
Standard input is empty
stdout
-2
0 0 0 0