답안 #992585

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
992585 2024-06-04T17:52:17 Z Abito Weirdtree (RMI21_weirdtree) C++17
21 / 100
2000 ms 7392 KB
#include "weirdtree.h"
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
const int NN=3e5+5;
ll n,a[NN];
void initialise(int N, int Q, int h[]) {
    n=N;
	for (int i=1;i<=n;i++) a[i]=h[i];
	return;
}
void cut(int l, int r, int kk) {
    ll k=kk;
    while (k>0){
        ll mx1=0,mx2=0,f=0,d=0;
        vector<int> v;
        for (int i=l;i<=r;i++) mx1=max(mx1,a[i]);
        if (mx1==0) break;
        for (int i=l;i<=r;i++){
            if (a[i]==mx1){
                v.pb(i);
                f++;
            }
            else mx2=max(mx2,a[i]);
        }
        //cout<<mx1<<' '<<mx2<<endl;
        d=(mx1-mx2);
        if (k>=d*f){
            for (auto u:v) a[u]=mx2;
            k-=d*f;
            continue;
        }
        for (auto u:v) a[u]-=k/f;
        for (int i=0;i<k%f;i++) a[v[i]]--;
        break;
    }return;
}
void magic(int i, int x) {
	a[i]=x;
	return;
}
long long int inspect(int l, int r) {
	ll sum=0;
	for (int i=l;i<=r;i++) sum+=a[i];
	return sum;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 496 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 496 KB Output is correct
3 Correct 1145 ms 4592 KB Output is correct
4 Correct 1128 ms 4724 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 3 ms 532 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 3 ms 532 KB Output is correct
3 Execution timed out 2019 ms 7392 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2051 ms 3852 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 496 KB Output is correct
3 Correct 1145 ms 4592 KB Output is correct
4 Correct 1128 ms 4724 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
6 Correct 3 ms 532 KB Output is correct
7 Correct 1138 ms 5204 KB Output is correct
8 Correct 1063 ms 5344 KB Output is correct
9 Correct 1090 ms 5456 KB Output is correct
10 Correct 1169 ms 5356 KB Output is correct
11 Correct 1122 ms 5460 KB Output is correct
12 Execution timed out 2021 ms 4504 KB Time limit exceeded
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 496 KB Output is correct
3 Correct 1145 ms 4592 KB Output is correct
4 Correct 1128 ms 4724 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
6 Correct 3 ms 532 KB Output is correct
7 Execution timed out 2019 ms 7392 KB Time limit exceeded
8 Halted 0 ms 0 KB -