Submission #986616

# Submission time Handle Problem Language Result Execution time Memory
986616 2024-05-20T21:55:46 Z mariaclara Rectangles (IOI19_rect) C++17
0 / 100
1 ms 348 KB
#include "rect.h"
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
const int MAXVAL = 2;
#define valid(x) (a[0][x] > a[1][x] and a[1][x] < a[2][x])
#define all(x) x.begin(), x.end()
#define sz(x) x.size()
#define mk make_pair
#define pb push_back
#define fr first
#define sc second

ll count_rectangles(vector<vector<int>> a) {
	int n = sz(a), m = sz(a[0]);

	int ans = 0;
	for(int i = 0, last = 0; i < m; i++) {
		if(valid(i) and (i==0 or !valid(i-1))) last = i;
		if(!valid(i) or (i < m-1 and valid(i+1))) continue;
		
		cout << last <<" " << i << "\n";
		int ms = -1;
		if(last > 0) ms = a[1][last-1];
		for(int j = last; j <= i; j++) {
			if(ms > a[1][j]) ans++;
			ms = max(ms, a[1][j]);
		}
		ms = -1;
		if(i < m-1) ms = a[1][i+1];
		for(int j = i; j >= i; j--) {
			if(ms > a[1][j]) ans++;
			ms = max(ms, a[1][j]);
		}
	}

	return ans/2;
}

Compilation message

rect.cpp: In function 'll count_rectangles(std::vector<std::vector<int> >)':
rect.cpp:18:6: warning: unused variable 'n' [-Wunused-variable]
   18 |  int n = sz(a), m = sz(a[0]);
      |      ^
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB secret mismatch
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB secret mismatch
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB secret mismatch
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB secret mismatch
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB secret mismatch
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB secret mismatch
2 Halted 0 ms 0 KB -