답안 #255634

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
255634 2020-08-01T13:09:14 Z uacoder123 Sterilizing Spray (JOI15_sterilizing) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define FOR(i,a,b) for (auto i = (a); i <= (b); ++i)
#define NFOR(i,a,b) for(auto i = (a); i >= (b); --i)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define mp(i,a) make_pair(i,a)
#define pb(a) push_back(a)
#define bit(x,b) (x&(1LL<<b))
 
typedef long long int lli;
typedef pair <lli,lli> ii;
typedef pair <lli,ii> iii;
typedef vector <lli> vi;
 
llli n,q,k;
lli segt[400001][33];
llli lazy[400001]={},crazy[100001]={};
lli qu(lli node,lli l,lli r,lli s,lli e)
{
  if(crazy[node]!=0)
  {
    lazy[node]=min(lazy[node]+crazy[node],32);
    crazy[2*node+1]+=crazy[node];
    crazy[2*node+2]+=crazy[node];
    crazy[node]=0;
  }
  if(r<s||l>e)
    return(0);
  if(l>=s&&r<=e)
    return(segt[node][lazy[node]]);
  lli m=(l+r)/2;
  lli q1=qu(2*node+1,l,m,s,e),q2=qu(2*node+2,m+1,r,s,e);
  return(q1+q2);
}
void up2(lli node,lli l,lli r,lli s,lli e)
{
  if(crazy[node]!=0)
  {
    lazy[node]=min(lazy[node]+crazy[node],32);
    crazy[2*node+1]+=crazy[node];
    crazy[2*node+2]+=crazy[node];
    crazy[node]=0;
  }
  if(l>e||r<s)
    return;
  if(l>=s&&r<=e)
  {
    lazy[node]=min(lazy[node]+1,32);
    crazy[2*node+1]=min(crazy[2*node+1]+1,32);
    crazy[2*node+2]=min(crazy[2*node+2]+1,32);
    return;
  }
  lli m=(l+r)/2;
  up2(2*node+1,l,m,s,e);
  up2(2*node+2,m+1,r,s,e);
}
llli c=0;
void up1(lli node,lli l,lli r,lli in,lli v)
{
  if(crazy[node]!=0)
  {
    lazy[node]=min(lazy[node]+crazy[node],32);
    crazy[2*node+1]+=crazy[node];
    crazy[2*node+2]+=crazy[node];
    crazy[node]=0;
  }
  if(l==r)
  {
    lazy[node]=0;
    crazy[node]=0;
    for(int i=0;i<32;++i)
    {
      segt[node][i]=(v);
      v/=k;
    }
    return;
  }
  lli m=(l+r)/2;
  if(in<=m)
    up1(2*node+1,l,m,in,v);
  else
    up1(2*node+2,m+1,r,in,v);
  lazy[node]=0;
  qu(2*node+1,l,m,l,m);
  qu(2*node+2,m+1,r,m+1,r);
  for(int i=0;i<33;++i)
    segt[node][i]=segt[2*node+1][min(lazy[2*node+1]+i,32)]+segt[2*node+2][min(lazy[2*node+2]+i,32)];
}
void init(lli node,lli l,lli r)
{
    for(int i=0;i<33;++i)
      segt[node][i]=0;
    lli m=(l+r)/2;
    if(l!=r)
    {
      init(2*node+1,l,m);
      init(2*node+2,m+1,r);
    }
}
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin>>n>>q>>k;
  init(0,0,n-1);
  for(lli i=0;i<n;++i)
  {
    lli f;
    cin>>f;
    up1(0,0,n-1,i,f);
  }
  for(lli i=0;i<q;++i)
  {
    lli f,s,t;
    cin>>f>>s>>t;
    if(f==1)
    {
      s--;
      up1(0,0,n-1,s,t);
    }
    else if(f==2)
    {
      s--;
      t--;
      up2(0,0,n-1,s,t);
    }
    else
    {
      s--;
      t--;
      cout<<qu(0,0,n-1,s,t)<<endl;
    }
  }
  return(0);
}

Compilation message

sterilizing.cpp:18:1: error: 'llli' does not name a type; did you mean 'lli'?
 llli n,q,k;
 ^~~~
 lli
sterilizing.cpp:20:1: error: 'llli' does not name a type; did you mean 'lli'?
 llli lazy[400001]={},crazy[100001]={};
 ^~~~
 lli
sterilizing.cpp:20:21: error: expected unqualified-id before ',' token
 llli lazy[400001]={},crazy[100001]={};
                     ^
sterilizing.cpp:20:35: error: expected constructor, destructor, or type conversion before '=' token
 llli lazy[400001]={},crazy[100001]={};
                                   ^
sterilizing.cpp: In function 'lli qu(lli, lli, lli, lli, lli)':
sterilizing.cpp:23:6: error: 'crazy' was not declared in this scope
   if(crazy[node]!=0)
      ^~~~~
sterilizing.cpp:25:5: error: 'lazy' was not declared in this scope
     lazy[node]=min(lazy[node]+crazy[node],32);
     ^~~~
sterilizing.cpp:25:5: note: suggested alternative: 'labs'
     lazy[node]=min(lazy[node]+crazy[node],32);
     ^~~~
     labs
sterilizing.cpp:33:23: error: 'lazy' was not declared in this scope
     return(segt[node][lazy[node]]);
                       ^~~~
sterilizing.cpp:33:23: note: suggested alternative: 'labs'
     return(segt[node][lazy[node]]);
                       ^~~~
                       labs
sterilizing.cpp: In function 'void up2(lli, lli, lli, lli, lli)':
sterilizing.cpp:40:6: error: 'crazy' was not declared in this scope
   if(crazy[node]!=0)
      ^~~~~
sterilizing.cpp:42:5: error: 'lazy' was not declared in this scope
     lazy[node]=min(lazy[node]+crazy[node],32);
     ^~~~
sterilizing.cpp:42:5: note: suggested alternative: 'labs'
     lazy[node]=min(lazy[node]+crazy[node],32);
     ^~~~
     labs
sterilizing.cpp:51:5: error: 'lazy' was not declared in this scope
     lazy[node]=min(lazy[node]+1,32);
     ^~~~
sterilizing.cpp:51:5: note: suggested alternative: 'labs'
     lazy[node]=min(lazy[node]+1,32);
     ^~~~
     labs
sterilizing.cpp:52:5: error: 'crazy' was not declared in this scope
     crazy[2*node+1]=min(crazy[2*node+1]+1,32);
     ^~~~~
sterilizing.cpp: At global scope:
sterilizing.cpp:60:1: error: 'llli' does not name a type; did you mean 'lli'?
 llli c=0;
 ^~~~
 lli
sterilizing.cpp: In function 'void up1(lli, lli, lli, lli, lli)':
sterilizing.cpp:63:6: error: 'crazy' was not declared in this scope
   if(crazy[node]!=0)
      ^~~~~
sterilizing.cpp:65:5: error: 'lazy' was not declared in this scope
     lazy[node]=min(lazy[node]+crazy[node],32);
     ^~~~
sterilizing.cpp:65:5: note: suggested alternative: 'labs'
     lazy[node]=min(lazy[node]+crazy[node],32);
     ^~~~
     labs
sterilizing.cpp:72:5: error: 'lazy' was not declared in this scope
     lazy[node]=0;
     ^~~~
sterilizing.cpp:72:5: note: suggested alternative: 'labs'
     lazy[node]=0;
     ^~~~
     labs
sterilizing.cpp:73:5: error: 'crazy' was not declared in this scope
     crazy[node]=0;
     ^~~~~
sterilizing.cpp:77:10: error: 'k' was not declared in this scope
       v/=k;
          ^
sterilizing.cpp:86:3: error: 'lazy' was not declared in this scope
   lazy[node]=0;
   ^~~~
sterilizing.cpp:86:3: note: suggested alternative: 'labs'
   lazy[node]=0;
   ^~~~
   labs
sterilizing.cpp: In function 'int main()':
sterilizing.cpp:107:8: error: 'n' was not declared in this scope
   cin>>n>>q>>k;
        ^
sterilizing.cpp:107:8: note: suggested alternative: 'yn'
   cin>>n>>q>>k;
        ^
        yn
sterilizing.cpp:107:11: error: 'q' was not declared in this scope
   cin>>n>>q>>k;
           ^
sterilizing.cpp:107:11: note: suggested alternative: 'qu'
   cin>>n>>q>>k;
           ^
           qu
sterilizing.cpp:107:14: error: 'k' was not declared in this scope
   cin>>n>>q>>k;
              ^