Submission #1071305

#TimeUsernameProblemLanguageResultExecution timeMemory
1071305vjudge1Addk (eJOI21_addk)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;
typedef long long int;
typedef long double ld;
#define pb push_back
#define sz size
#define mp make_pair
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fre(s) freopen(s".in", "r", stdin);freopen(s".out", "w", stdout);
#define s second
#define f first
#define ii pair<ll,ll>
const ll mod=1e9+7;
const int N=4e5+6;
const ll inf=1e12+5;      
int n,k,d[N],g[N];
int main() 
{
    ios
    cin>>n>>k;
    for(int i=1;i<=n;++i)
    {
        cin>>d[i];
    }
    int q;
    cin>>q;
    while(q--)
    {
        int x;
        cin>>x;
        if(x==1)
        {
          
            for(int i=0;i<k;++i)
            {
                cin>>g[i];
            }
            if(k>1)
            {
                int h=d[g[0]];
                for(int i=0;i<k-1;i++)
                {
                    d[g[i]]=d[g[i+1]];
                }
                d[g[k-1]]=h;
            }
          
        }
        else
        {
            int l,r,m;
            cin>>l>>r>>m;
            int ans=0;
            if(r-l+1<m)
            {
                cout<<0<<"\n";
                continue;
            }
            for(int i=l;i<=r;++i)
            {
                int cur=m;
                cur-=max(ll0,m-(i-l+1));
                cur-=max(ll0,m-(r-i+1));
                ans+=d[i]*cur;
            }
            cout<<ans<<endl;
        }
  }
}

Compilation message (stderr)

Main.cpp:3:19: error: declaration does not declare anything [-fpermissive]
    3 | typedef long long int;
      |                   ^~~
Main.cpp:15:7: error: 'll' does not name a type; did you mean 'ld'?
   15 | const ll mod=1e9+7;
      |       ^~
      |       ld
Main.cpp:17:7: error: 'll' does not name a type; did you mean 'ld'?
   17 | const ll inf=1e12+5;
      |       ^~
      |       ld
Main.cpp: In function 'int main()':
Main.cpp:64:26: error: 'll0' was not declared in this scope
   64 |                 cur-=max(ll0,m-(i-l+1));
      |                          ^~~