fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. const int N=30005;
  4. int n,q,T;
  5. int a[N],b[N];
  6. int bit[10005][180];
  7. inline void up(int i,int j,int x)
  8. {
  9. for(int v=j;v;v-=v&-v)
  10. for(int u=i;u;u-=u&-u)
  11. bit[v][u]+=x;
  12. }
  13. inline int get(int i,int j)
  14. {
  15. int re=0;
  16. for(int v=j;v<=10000;v+=v&-v)
  17. for(int u=i;u<=T+1;u+=u&-u)
  18. re+=bit[v][u];
  19. return re;
  20. }
  21. int main()
  22. {
  23. cin>>n;T=sqrt(n);
  24. for(int i=1;i<=n;++i) cin>>a[i],b[i]=(i-1)/T+1,up(b[i],a[i],1);
  25. cin>>q;while(q--)
  26. {
  27. int o,i,j;cin>>o>>i>>j;
  28. if(!o)
  29. {
  30. up(b[i],a[i],-1);a[i]=j;
  31. up(b[i],a[i],1);
  32. }
  33. else
  34. {
  35. int k,l,r,kq=0;cin>>k;
  36. if(j-i<T*4)
  37. {
  38. for(int t=i;t<=j;++t) kq+=a[t]>k;
  39. cout<<kq<<"\n";
  40. continue;
  41. }
  42. l=b[i]+1,r=b[j]-1;
  43. kq=get(l,k+1)-get(r+1,k+1);
  44. for(int t=i;t<=(l-1)*T;++t) kq+=a[t]>k;
  45. for(int t=r*T+1;t<=j;++t) kq+=a[t]>k;
  46. cout<<kq<<"\n";
  47. }
  48. }
  49. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: error: illegal character: '#'
#include <bits/stdc++.h>
^
Main.java:1: error: class, interface, or enum expected
#include <bits/stdc++.h>
         ^
Main.java:3: error: class, interface, or enum expected
const int N=30005;
^
Main.java:4: error: class, interface, or enum expected
int n,q,T;
^
Main.java:5: error: class, interface, or enum expected
int a[N],b[N];
^
Main.java:6: error: class, interface, or enum expected
int bit[10005][180];
^
Main.java:7: error: class, interface, or enum expected
inline void up(int i,int j,int x)
^
Main.java:9: error: class, interface, or enum expected
    for(int v=j;v;v-=v&-v)
                ^
Main.java:9: error: class, interface, or enum expected
    for(int v=j;v;v-=v&-v)
                  ^
Main.java:10: error: class, interface, or enum expected
    for(int u=i;u;u-=u&-u)
                ^
Main.java:10: error: class, interface, or enum expected
    for(int u=i;u;u-=u&-u)
                  ^
Main.java:12: error: class, interface, or enum expected
}
^
Main.java:16: error: class, interface, or enum expected
    for(int v=j;v<=10000;v+=v&-v)
    ^
Main.java:16: error: class, interface, or enum expected
    for(int v=j;v<=10000;v+=v&-v)
                ^
Main.java:16: error: class, interface, or enum expected
    for(int v=j;v<=10000;v+=v&-v)
                         ^
Main.java:17: error: class, interface, or enum expected
    for(int u=i;u<=T+1;u+=u&-u)
                ^
Main.java:17: error: class, interface, or enum expected
    for(int u=i;u<=T+1;u+=u&-u)
                       ^
Main.java:19: error: class, interface, or enum expected
    return re;
    ^
Main.java:20: error: class, interface, or enum expected
}
^
Main.java:23: error: class, interface, or enum expected
	cin>>n;T=sqrt(n);
	       ^
Main.java:24: error: class, interface, or enum expected
    for(int i=1;i<=n;++i) cin>>a[i],b[i]=(i-1)/T+1,up(b[i],a[i],1);
    ^
Main.java:24: error: class, interface, or enum expected
    for(int i=1;i<=n;++i) cin>>a[i],b[i]=(i-1)/T+1,up(b[i],a[i],1);
                ^
Main.java:24: error: class, interface, or enum expected
    for(int i=1;i<=n;++i) cin>>a[i],b[i]=(i-1)/T+1,up(b[i],a[i],1);
                     ^
Main.java:25: error: class, interface, or enum expected
    cin>>q;while(q--)
    ^
Main.java:25: error: class, interface, or enum expected
    cin>>q;while(q--)
           ^
Main.java:27: error: class, interface, or enum expected
        int o,i,j;cin>>o>>i>>j;
                  ^
Main.java:28: error: class, interface, or enum expected
        if(!o)
        ^
Main.java:30: error: class, interface, or enum expected
            up(b[i],a[i],-1);a[i]=j;
                             ^
Main.java:31: error: class, interface, or enum expected
            up(b[i],a[i],1);
            ^
Main.java:32: error: class, interface, or enum expected
        }
        ^
Main.java:35: error: class, interface, or enum expected
            int k,l,r,kq=0;cin>>k;
                           ^
Main.java:36: error: class, interface, or enum expected
            if(j-i<T*4)
            ^
Main.java:38: error: class, interface, or enum expected
                for(int t=i;t<=j;++t)   kq+=a[t]>k;
                            ^
Main.java:38: error: class, interface, or enum expected
                for(int t=i;t<=j;++t)   kq+=a[t]>k;
                                 ^
Main.java:39: error: class, interface, or enum expected
                cout<<kq<<"\n";
                ^
Main.java:40: error: class, interface, or enum expected
                continue;
                ^
Main.java:41: error: class, interface, or enum expected
            }
            ^
Main.java:43: error: class, interface, or enum expected
            kq=get(l,k+1)-get(r+1,k+1);
            ^
Main.java:44: error: class, interface, or enum expected
            for(int t=i;t<=(l-1)*T;++t) kq+=a[t]>k;
            ^
Main.java:44: error: class, interface, or enum expected
            for(int t=i;t<=(l-1)*T;++t) kq+=a[t]>k;
                        ^
Main.java:44: error: class, interface, or enum expected
            for(int t=i;t<=(l-1)*T;++t) kq+=a[t]>k;
                                   ^
Main.java:45: error: class, interface, or enum expected
            for(int t=r*T+1;t<=j;++t)   kq+=a[t]>k;
            ^
Main.java:45: error: class, interface, or enum expected
            for(int t=r*T+1;t<=j;++t)   kq+=a[t]>k;
                            ^
Main.java:45: error: class, interface, or enum expected
            for(int t=r*T+1;t<=j;++t)   kq+=a[t]>k;
                                 ^
Main.java:46: error: class, interface, or enum expected
            cout<<kq<<"\n";
            ^
Main.java:47: error: class, interface, or enum expected
        }
        ^
46 errors
stdout
Standard output is empty