Submission #207341

# Submission time Handle Problem Language Result Execution time Memory
207341 2020-03-07T08:52:29 Z balbit Rectangles (IOI19_rect) C++14
0 / 100
5 ms 376 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pb push_back
#define SZ(x) (int)((x).size())
#define ALL(x) x.begin(),x.end()

#define pii pair<int, int>
#define f first
#define s second

#ifdef BALBIT
#define bug(...) cerr<<"#"<<__LINE__<<": "<<#__VA_ARGS__<<" = ", _do(__VA_ARGS__)
template<typename T> void _do(T &&x) {cerr<<x<<endl;}
template<typename T, typename ...S> void _do(T &&x, S&&...y) {cerr<<x<<", "; _do(y...);}
#define IOS()
#else
#define IOS() ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
#define bug(...)
#endif // BALBIT

const int MX = 205;


#define REP(i,n) for (int i = 0; i<n; ++i)
#define RREP(i,n) for (int i = n-1; i>=0; --i)
#define FOR(i,a,b) for (int i = a; i<b; i++)


ll count_rectangles(vector<vector<int> > a) {
    int n = SZ(a);
    int m = SZ(a[0]);
    int lb = 0;
    ll re = 0;

    for (int i = 1; i<n-1; ++i) {
        int x = a[1][i];
        bool ok = x < a[0][i] && x < a[2][i];;
        bool R = ok && x < a[1][i+1];
        if (!ok) {
            lb = i;
        }
        else{
            while (lb < i && (a[1][lb] <= x)) ++lb;
            bug(i,lb,R);
            if (R) re += i-lb;
        }
    }
    return re;
}

#ifdef BALBIT
signed main(){
    IOS();
    ll ro = count_rectangles({{1,1,1},{1,1,1},{1,1,1}});
    bug(ro);
}
#endif

Compilation message

rect.cpp: In function 'long long int count_rectangles(std::vector<std::vector<int> >)':
rect.cpp:34:9: warning: unused variable 'm' [-Wunused-variable]
     int m = SZ(a[0]);
         ^
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -