QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#735780#6533. Traveling in Cells_xqy_WA 0ms3584kbC++202.4kb2024-11-11 21:39:022024-11-11 21:39:06

Judging History

你现在查看的是最新测评结果

  • [2024-11-11 21:39:06]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3584kb
  • [2024-11-11 21:39:02]
  • 提交

answer

#include <bits/stdc++.h>
using LL = long long;
using namespace std;
constexpr int N = 1E5 + 5 , M = N * 3;

int cnt , rt[N] , ls[(M << 5) + 5] , rs[(M << 5) + 5] , sum[(M << 5) + 5];
void pushup(int u) {
	sum[u] = sum[ls[u]] + sum[rs[u]];
}
void update(int &u,int l,int r,int pos,int v) {
	if (u == 0) u = ++cnt;
	if (l == r) {
		sum[u] += v;
		return;
	}
	int md = (l + r) >> 1;
	if (pos <= md) update(ls[u] , l , md , pos , v);
	else update(rs[u] , md + 1 , r , pos , v);
	pushup(u);
}
int query(int u,int l,int r,int ql,int qr) {
	if (u == 0) return 0;
	if (l == ql && r == qr) {
		return sum[u];
	}
	int md = (l + r) >> 1;
	if (qr <= md) return query(ls[u] , l , md , ql , qr);
	else if (ql > md) return query(rs[u] , md + 1 , r , ql , qr);
	else {
		return query(ls[u] , l , md , ql , md) + query(rs[u] , md + 1 , r , md + 1 , qr);
	}
}
template<typename T>
struct Fenwick{
    int n;
    std::vector<T> tr;

    Fenwick(int n) : n(n), tr(n + 1, 0){}

    int lowbit(int x){
        return x & -x;
    }

    void modify(int x, T c){
        for(int i = x; i <= n; i += lowbit(i)) tr[i] += c;
    }

    void modify(int l, int r, T c){
        modify(l, c);
        if (r + 1 <= n) modify(r + 1, -c);
    }

    T query(int x){
        T res = T();
        for(int i = x; i; i -= lowbit(i)) res += tr[i];
        return res;
    }

    T query(int l, int r){
        return query(r) - query(l - 1);
    }

    int find_first(T sum){
        int ans = 0; T val = 0;
        for(int i = std::__lg(n); i >= 0; i--){
            if ((ans | (1 << i)) <= n && val + tr[ans | (1 << i)] < sum){
                ans |= 1 << i;
                val += tr[ans];
            }
        }
        return ans + 1;
    }

    int find_last(T sum){
        int ans = 0; T val = 0;
        for(int i = std::__lg(n); i >= 0; i--){
            if ((ans | (1 << i)) <= n && val + tr[ans | (1 << i)] <= sum){
                ans |= 1 << i;
                val += tr[ans];
            }
        }
        return ans;
    }

};
using BIT = Fenwick<LL>;

void clear() {
	for (int i = 1 ; i <= cnt ; ++i) {
		rt[i] = ls[i] = rs[i] = sum[i] = 0;
	}
	cnt = 0;
}
void solve() {
	int n = 3E5 + 5;
	int x = __lg(n);
	cout << x * x;
}

int main() {

	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	int t = 1;
	// cin >> t;
	while (t--) {
		solve();
	}

	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3584kb

input:

2
5 10
1 2 3 1 2
1 10 100 1000 10000
3 3 1 3
3 3 2 2 3
2 5 20000
2 3 200
3 3 2 1 3
3 3 3 1 2 3
1 3 4
2 1 100000
1 2 2
3 1 2 1 2
4 1
1 2 3 4
1000000 1000000 1000000 1000000
3 4 4 1 2 3 4

output:

324

result:

wrong answer 1st numbers differ - expected: '100', found: '324'