Submission #696391

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
6963912023-02-06 11:12:54sharaelongHoliday (IOI14_holiday)C++17
77 / 100
539 ms7264 KiB
#include "holiday.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
struct SegmentTree {
int n, h;
vector<ll> base;
vector<int> cnt;
vector<ll> sum;
SegmentTree() {}
SegmentTree(int _n, const vector<ll>& arr) : n(_n) {
h = Log2(n);
n = 1 << h;
base.resize(2*n, 0);
for (int i=0; i<arr.size(); ++i) base[n+i] = arr[i];
cnt.resize(2*n, 0);
sum.resize(2*n, 0);
}
void update(int p, int v) {
p += n;
cnt[p] += v;
sum[p] += base[p] * v;
for (p/=2; p>0; p/=2) {
cnt[p] = cnt[2*p] + cnt[2*p+1];
sum[p] = sum[2*p] + sum[2*p+1];
}
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

holiday.cpp: In constructor 'SegmentTree::SegmentTree(int, const std::vector<long long int>&)':
holiday.cpp:17:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |         for (int i=0; i<arr.size(); ++i) base[n+i] = arr[i];
      |                       ~^~~~~~~~~~~
holiday.cpp: At global scope:
holiday.cpp:72:13: warning: 'void test()' defined but not used [-Wunused-function]
   72 | static void test() {
      |             ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...