Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
//#include
using namespace std; typedef long long ll; const int maxn = 3e5 + 10; const ll INF = 3e16 + 10; struct node { int sum, cnt; node() {} node(int _sum, int _cnt) { sum = _sum; cnt = _cnt; } }; node segment_tree[3 * maxn]; node my_merge(node A, node B) { return node(A.sum + B.sum, A.cnt + B.cnt); } node query(int L, int R, int pos, int i, int j) { // L R i L R j L R if(i <= L and R <= j) { return segment_tree[pos]; } if(R < i or j < L) { return node(0, 0); } int mid = (L + R) / 2; return my_merge(query(L, mid, 2 * pos, i, j), query(mid + 1, R, 2 * pos + 1, i, j)); } int main() { ios_base::sync_with_stdio(false); return 0; }
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)