Submission #1242640

#TimeUsernameProblemLanguageResultExecution timeMemory
1242640haithamcoderRectangles (IOI19_rect)C++20
0 / 100
0 ms320 KiB
#include "rect.h"
#include<bits/stdc++.h>
using namespace std;
// typedef long long ll;
#define ll int

#define db(x) cerr << #x << " = " << x << " | "
#define dbg(x) cerr << #x << " = " << x << "\n"


long long count_rectangles(std::vector<std::vector<int>> a) {
	ll n = a.size(), m = a[0].size();

	long long res = 0;
	for (ll j = 1; j < m - 1; j++) {
		if (a[1][j - 1] < a[1][j] || a[1][j + 1] < a[1][j]) continue;

		ll mx = a[1][j];
		for (ll k = j; k < m - 1; k++) {
			if (a[0][k] < a[1][k] || a[2][k] < a[1][k]) {
				break;
			} else {
				mx = max(mx, a[1][k]);
				if (a[1][k + 1] < mx) break; 
				else res++;
			} 
		}
	}
}

Compilation message (stderr)

rect.cpp: In function 'long long int count_rectangles(std::vector<std::vector<int> >)':
rect.cpp:29:1: warning: no return statement in function returning non-void [-Wreturn-type]
   29 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...