Submission #707571

# Submission time Handle Problem Language Result Execution time Memory
707571 2023-03-09T10:56:15 Z Trisanu_Das Osumnjičeni (COCI21_osumnjiceni) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
 
const int mxN=2e5;
int n, q, l[mxN], r[mxN], anc[mxN][18];
 
int main() {
	cin >> n;
	for (int i=0; i<n; ++i) cin >> l[i] >> r[i];
	set<arrray<int, 2>> s;
	for (int i=n-1, j=n-1; ~i; --i) {
		while(true) {
			if (s.empty()||r[i]<(*s.begin())[0]||l[i]>(*s.rbegin())[1]) {
				s.insert({l[i], r[i]});
				break;
			}
			auto it=s.lower_bound({l[i], -1});
			if ((it==s.end()||r[i]<(*it)[0])&&(it==s.begin()||(*prev(it))[1]<l[i])) {
				s.insert({l[i], r[i]});
				break;
			}
			s.erase({l[j], r[j]});
			--j;
		}
		anc[i][0]=j+1;
	}
	for (int j=1; j<18; ++j) for (int i=0; i<n; ++i) anc[i][j]=anc[i][j-1]==n?n:anc[anc[i][j-1]][j-1];
	cin >> q;
	while(q--) {
		int a, b;
		cin >> a >> b, --a, --b;
		int ans = 1;
		for (int i = 17; i > 0; --i)
			if (anc[a][i] <= b) {
				ans += 1 << i;
				a = anc[a][i];
			}
		cout << ans << "\n";
	}
	return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:12:6: error: 'arrray' was not declared in this scope
   12 |  set<arrray<int, 2>> s;
      |      ^~~~~~
Main.cpp:12:19: error: template argument 1 is invalid
   12 |  set<arrray<int, 2>> s;
      |                   ^~
Main.cpp:12:19: error: template argument 2 is invalid
Main.cpp:12:19: error: template argument 3 is invalid
Main.cpp:15:10: error: request for member 'empty' in 's', which is of non-class type 'int'
   15 |    if (s.empty()||r[i]<(*s.begin())[0]||l[i]>(*s.rbegin())[1]) {
      |          ^~~~~
Main.cpp:15:28: error: request for member 'begin' in 's', which is of non-class type 'int'
   15 |    if (s.empty()||r[i]<(*s.begin())[0]||l[i]>(*s.rbegin())[1]) {
      |                            ^~~~~
Main.cpp:15:50: error: request for member 'rbegin' in 's', which is of non-class type 'int'
   15 |    if (s.empty()||r[i]<(*s.begin())[0]||l[i]>(*s.rbegin())[1]) {
      |                                                  ^~~~~~
Main.cpp:16:7: error: request for member 'insert' in 's', which is of non-class type 'int'
   16 |     s.insert({l[i], r[i]});
      |       ^~~~~~
Main.cpp:19:14: error: request for member 'lower_bound' in 's', which is of non-class type 'int'
   19 |    auto it=s.lower_bound({l[i], -1});
      |              ^~~~~~~~~~~
Main.cpp:20:15: error: request for member 'end' in 's', which is of non-class type 'int'
   20 |    if ((it==s.end()||r[i]<(*it)[0])&&(it==s.begin()||(*prev(it))[1]<l[i])) {
      |               ^~~
Main.cpp:20:45: error: request for member 'begin' in 's', which is of non-class type 'int'
   20 |    if ((it==s.end()||r[i]<(*it)[0])&&(it==s.begin()||(*prev(it))[1]<l[i])) {
      |                                             ^~~~~
Main.cpp:21:7: error: request for member 'insert' in 's', which is of non-class type 'int'
   21 |     s.insert({l[i], r[i]});
      |       ^~~~~~
Main.cpp:24:6: error: request for member 'erase' in 's', which is of non-class type 'int'
   24 |    s.erase({l[j], r[j]});
      |      ^~~~~