Submission #418411

#TimeUsernameProblemLanguageResultExecution timeMemory
418411jasminRectangles (IOI19_rect)C++14
Compilation error
0 ms0 KiB
#include "rect.h"

long long count_rectangles(std::vector<std::vector<int> > r){
    int n=r.size(); int m=r[0].size();
    if(n!=3) return 1;

    long long ans=0;
    for(int i=1; i<m-1; i++){
        int maxi=0;
        for(int j=i; j<m-1; j++){
            maxi=max(maxi, r[1][j]);
            if(r[0][j]<=r[1][j] || r[2][j]<=r[1][j]) break;
            if(r[1][i-1]>maxi && r[1][j+1]>maxi){
                ans++;
            }
        }
    }
    return ans;
}

Compilation message (stderr)

rect.cpp: In function 'long long int count_rectangles(std::vector<std::vector<int> >)':
rect.cpp:11:18: error: 'max' was not declared in this scope; did you mean 'std::max'?
   11 |             maxi=max(maxi, r[1][j]);
      |                  ^~~
      |                  std::max
In file included from /usr/include/c++/10/vector:60,
                 from rect.h:5,
                 from rect.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:300:5: note: 'std::max' declared here
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~