Submission #1147276

#TimeUsernameProblemLanguageResultExecution timeMemory
1147276Math4Life2020Weirdtree (RMI21_weirdtree)C++20
Compilation error
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; }

Compilation message (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'