QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#508486#7660. Investigating Frog Behaviour on Lily Pad PatternsPoknikCompile Error//C++141.2kb2024-08-07 16:21:082024-08-07 16:21:08

Judging History

This is the latest submission verdict.

  • [2024-08-07 16:21:08]
  • Judged
  • [2024-08-07 16:21:08]
  • Submitted

answer

#include<bitsdc++.h>
#define INF 100100
#define maxx 100000007
#define pi 3.14159265359
using namespace std;
typedef long long LL;
set<int> emptypos;
int pos[INF]={0};
int qing[INF]={0};
int myfind(int x)
{
    for(int i=1;i<=INF;i++)
    {
        if(pos[i]==x)
        {
            return i;
        }
    }
}
int main()
{
//    ios::sync_with_stdio(false);
//    cin.tie(0);
//    cout.tie(0);
    //freopen("in.txt","r",stdin);
    int n;
    scanf("%d",&n);
    int x;
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&x);
        pos[x]=i;
        qing[i]=x;
    }
    for(int i=1;i<=qing[n];i++)
    {
        if(pos[i]==0)
            emptypos.insert(i);
    }
//    set<int>::iterator it;
//    for(it=emptypos.begin();it!=emptypos.end();it++)
//        cout<<*it<<" ";
    for(int i=qing[n]+1;i<=INF;i++)
        emptypos.insert(i);
    int t;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d",&x);
        int xx=qing[x];
        int y=*upper_bound(emptypos.begin(),emptypos.end(),xx);
        printf("%d\n",y);
        emptypos.erase(y);
        emptypos.insert(xx);
        pos[y]=x;
        pos[xx]=0;
    }
    return 0;
}

Details

answer.code:1:9: fatal error: bitsdc++.h: No such file or directory
    1 | #include<bitsdc++.h>
      |         ^~~~~~~~~~~~
compilation terminated.