# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
207346 |
2020-03-07T09:06:05 Z |
balbit |
Rectangles (IOI19_rect) |
C++14 |
|
0 ms |
0 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;
stack<int> bb; // big boys
bb.push (a[1][0]);
for (int i = 1; i<m-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) {
while (!bb.empty()) bb.pop();
bb.push(x);
}
else{
while (!bb.empty() && bb.top() <= x ) bb.pop();
if (R) re += bb.size(), bug(bb.size());
bb.push(x);
}
}
return re;
}
#ifdef BALBIT
signed main(){
IOS();
ll ro = count_rectangles({{1,1,1,1},{1,0,0,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:49:51: error: expected primary-expression before ';' token
if (R) re += bb.size(), bug(bb.size());
^
rect.cpp:33:9: warning: unused variable 'n' [-Wunused-variable]
int n = SZ(a);
^
rect.cpp:35:9: warning: unused variable 'lb' [-Wunused-variable]
int lb = 0;
^~