Submission #866661

# Submission time Handle Problem Language Result Execution time Memory
866661 2023-10-26T16:06:59 Z nasir_bashirov Quality Of Living (IOI10_quality) C++17
Compilation error
0 ms 0 KB
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
 
#include "quality.h"
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <bits/stdc++.h>
using namespace std;
using namespace __gnu_pbds;
 
#define db long double
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define endl '\n'
#define all(x) x.begin(), x.end()
#define fastio\
    ios_base::sync_with_stdio(0);\
    cin.tie(0);\
    cout.tie(0)\
 
struct fenwickTree{
    int n;
    vi BIT;
    fenwickTree(int sz){
        n = sz;
        BIT.resize(n + 1, 0);
    }
    void update(int i, int v){
        if(i == 0)    return;
        while(i <= n){
            BIT[i] += v;
            i += i & (-i);
        }
    }
    int query(int l, int r){
        if(l > r)   return 0;   
        if(l != 1)    return query(1, r) - query(1, l - 1);
        int res = 0;
        while(r > 0){
            res += BIT[r];
            r -= r & (-r);
        }
        return res;
    }
};

typedef tree<
pii,
null_type,
less<pii>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
 
int rectangle(int r, int c, int h, int w, int Q[3001][3001]) {
	int res = 1e9, tt = 0;
	for(int i = 1; i <= r - h + 1; i++){
		ordered_set st;
		for(int a = 1; a < w; a++){
			for(int b = i; b <= i + h - 1; b++){
				st.insert({Q[b - 1][a - 1], t++});
			}
		}
		for(int a = w; a <= c; a++){
			for(int b = i; b <= i + h - 1; b++){
				st.insert({Q[b - 1][a - 1], t++});
			}
			if(a > w){
				for(int b = i; b <= i + h - 1; b++){
					st.erase(st.lowerbound({Q[b - 1][a - 1], 0}));
				}
			}
			res = min(res, (*st.find_by_order(h * w / 2)).first);
		}
	}
	return res;
}

Compilation message

quality.cpp:51:9: error: 'tree' does not name a type; did you mean 'free'?
   51 | typedef tree<
      |         ^~~~
      |         free
quality.cpp: In function 'int rectangle(int, int, int, int, int (*)[3001])':
quality.cpp:62:3: error: 'ordered_set' was not declared in this scope
   62 |   ordered_set st;
      |   ^~~~~~~~~~~
quality.cpp:65:5: error: 'st' was not declared in this scope; did you mean 'tt'?
   65 |     st.insert({Q[b - 1][a - 1], t++});
      |     ^~
      |     tt
quality.cpp:65:33: error: 't' was not declared in this scope
   65 |     st.insert({Q[b - 1][a - 1], t++});
      |                                 ^
quality.cpp:70:5: error: 'st' was not declared in this scope; did you mean 'tt'?
   70 |     st.insert({Q[b - 1][a - 1], t++});
      |     ^~
      |     tt
quality.cpp:70:33: error: 't' was not declared in this scope
   70 |     st.insert({Q[b - 1][a - 1], t++});
      |                                 ^
quality.cpp:74:6: error: 'st' was not declared in this scope; did you mean 'tt'?
   74 |      st.erase(st.lowerbound({Q[b - 1][a - 1], 0}));
      |      ^~
      |      tt
quality.cpp:77:21: error: 'st' was not declared in this scope; did you mean 'tt'?
   77 |    res = min(res, (*st.find_by_order(h * w / 2)).first);
      |                     ^~
      |                     tt
quality.cpp:60:17: warning: unused variable 'tt' [-Wunused-variable]
   60 |  int res = 1e9, tt = 0;
      |                 ^~