제출 #1147276

#제출 시각아이디문제언어결과실행 시간메모리
1147276Math4Life2020Weirdtree (RMI21_weirdtree)C++20
컴파일 에러
0 ms0 KiB
#include "weirdtree.h"
#include <bits/stdc++.h>
using namespace std;

long long h1[5e5];

void initialise(int N, int Q, int h0[]) {
    for (long long i=0;i<N;i++) {
        h1[i+1]=h0[i];
    }
}

void cut(int l, int r, int k) {
    while (k>0) {
        long long xloc = -1;
        long long mval = 0;
        for (long long i=l;i<=r;i++) {
            if (h1[i]>mval) {
                mval = h1[i];
                xloc = i;
            }
        }
        if (xloc==-1) {
            break;
        }
        h1[xloc]--;
        k--;
    }
}

void magic(int i, int x) {
    h1[i]=x;
}

long long inspect(int l, int r) {
    long long vf = 0;
    for (long long i=l;i<=r;i++) {
        vf += h1[i];
    }
    return vf;
}

컴파일 시 표준 에러 (stderr) 메시지

weirdtree.cpp:5:14: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    5 | long long h1[5e5];
      |              ^~~
weirdtree.cpp:5:14: error: could not convert '5.0e+5' from 'double' to 'long unsigned int'
    5 | long long h1[5e5];
      |              ^~~
      |              |
      |              double
weirdtree.cpp:5:14: error: size of array 'h1' has non-integral type 'double'