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
using namespace std; using namespace std; const int maxn=350005; int n; vector
g[maxn]; bool vis[maxn]; vector
v; int st[3*maxn]; void btree(int L,int R,int pos) { if(L==R) { st[pos]=0; return ; } int mid=(L+R)/2; btree(L,mid,2*pos); btree(mid+1,R,2*pos+1); st[pos]=st[2*pos]+st[2*pos+1]; } void u(int L,int R,int idx,int pos) { if(L==R) { st[pos]=1; return ; } int mid=(L+R)/2; if(idx<=mid) { u(L,mid,idx,2*pos); } else { u(mid+1,R,idx,2*pos+1); } st[pos]=st[2*pos]+st[2*pos+1]; } int query(int L,int R,int i,int j,int pos) { //L R i L R j L R if(i<=L && R<=j) { return st[pos]; } if(j
>n; memset(vis,0,sizeof vis); for(int i=1;i<=n;i++) { char c; cin>>c; if(c=='K') { g[i-1].push_back(i-1); } else { int num; cin>>num; g[num-1].push_back(i-1); } } for(int idx=0;idx
>ans; for(int i=0;i
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)