Submission #1149909

#TimeUsernameProblemLanguageResultExecution timeMemory
1149909henriessIntercastellar (JOI22_ho_t1)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

	

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    long long n;cin >> n;
    vector<long long> A(n);
    segtree = new node(0,n-1);
    for(int i = 0;i<n;i++){
		cin >> A[i];
	}
	long long q;cin >> q;
	vector<pair<long long,long long>> X(q);
	for(int i = 0;i<q;i++){
		cin >> X[i].first;
		X[i].second = i;
	}
	sort(X.begin(),X.end());
	vector<long long> output(q);
	long long start = 1;
	long long end = 0;
	long long index = 0;
	for(int i = 0;i<n;i++){
		
		long long times = 0;
		long long temp = A[i];
		long long val = A[i];
		bool even = false;
		while (temp % 2 == 0){
			even = true;
			temp /= 2;
			times += 1;
		}
		if (even){
			val = A[i] / (pow(2,times));
		}
		end += pow(2,times);
		while (index < X.size() && X[index].first <= end){
			output[X[index].second] = val;
			index += 1;
		}
		
		
	}
	for(int i = 0;i<q;i++){
		cout << output[i] << '\n';
	}
}

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:12:5: error: 'segtree' was not declared in this scope
   12 |     segtree = new node(0,n-1);
      |     ^~~~~~~
Main.cpp:12:19: error: expected type-specifier before 'node'
   12 |     segtree = new node(0,n-1);
      |                   ^~~~