QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#247992#7619. Make SYSU Great Again Iucup-team1525#Compile Error//C++201.8kb2023-11-11 16:53:432023-11-11 16:53:44

Judging History

你现在查看的是最新测评结果

  • [2023-11-11 16:53:44]
  • 评测
  • [2023-11-11 16:53:43]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int n,m,r;
const int N=500005;
#define ll long long
ll k;
ll a[N];
vector<ll> v;
map<int,int> mp;
int t[N*4];
ll nowx,nowp,nowy;
char s[100];
ll o;
int add(int x,int l,int r,int y)
{
    ++t[x];
    if (l==r)
        return;
    int mid=(l+r)/2;
    if (y<=mid)
        add(x*2,l,mid,y);
    else
        add(x*2+1,mid+1,r,y);
}
int ask(int x,int l,int r,int y)
{
    if (l==r)
        return l;
    int mid=(l+r)*2;
    if (t[x*2+1]>=y)
        return ask(x*2+1,mid+1,r,y);
    else
        return ask(x*2,l,mid,y-t[x*2+1]);
}
inline void upd()
{
    while (nowp<=n&&a[nowp+1]/k==nowx)
    {
        ++nowp;
        add(1,1,r,mp[a[nowp]%k]);
    }
}
int main()
{
    scanf("%d%d%lld",&n,&m,&k);
    for (int i=1;i<=n;++i)
    {
        scanf("%lld",&a[i]);
        v.push_back(a[i]%k);
    }
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
    r=v.size();
    for (int i=0;i<(int)v.size();++i)
        mp[v[i]]=i+1;
    sort(a+1,a+1+n,greater<ll>());
    nowx=a[1]/k;
    upd();
    while (k--)
    {
        scanf("%s%lld",s,o);
        if (s[0]=='A')
        {
            if (nowy+o<t[1])
            {
                nowy+=o;
            }
            else
            {
                nowx--;
                o-=(t[1]-nowy);
                nowy=0;
                int nnowx=nowx-o/t[1],nnowy=o%t[1];
                while (nowp<=)
            }
        }
        else
        {
            if (o>t[1])
                printf("%lld\n",a[o]);
            else
            {
                if (o<=t[1]-nowy)
                    printf("%lld\n",v[ask(1,1,r,nowy+o)]+nowx*k);
                else
                    printf("%lld\n",v[ask(1,1,r,o-(t[1]-nowy))]+nowx*k);
            }
        }
    }
    return 0;
}

Details

answer.code: In function ‘int add(int, int, int, int)’:
answer.code:18:9: error: return-statement with no value, in function returning ‘int’ [-fpermissive]
   18 |         return;
      |         ^~~~~~
answer.code: In function ‘int main()’:
answer.code:61:21: warning: format ‘%lld’ expects argument of type ‘long long int*’, but argument 3 has type ‘long long int’ [-Wformat=]
   61 |         scanf("%s%lld",s,o);
      |                  ~~~^    ~
      |                     |    |
      |                     |    long long int
      |                     long long int*
answer.code:74:30: error: expected primary-expression before ‘)’ token
   74 |                 while (nowp<=)
      |                              ^
answer.code:75:13: error: expected primary-expression before ‘}’ token
   75 |             }
      |             ^
answer.code: In function ‘int add(int, int, int, int)’:
answer.code:24:1: warning: control reaches end of non-void function [-Wreturn-type]
   24 | }
      | ^
answer.code: In function ‘int main()’:
answer.code:45:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   45 |     scanf("%d%d%lld",&n,&m,&k);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~
answer.code:48:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   48 |         scanf("%lld",&a[i]);
      |         ~~~~~^~~~~~~~~~~~~~
answer.code:61:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   61 |         scanf("%s%lld",s,o);
      |         ~~~~~^~~~~~~~~~~~~~