답안 #964114

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
964114 2024-04-16T10:41:31 Z vivkostov 로봇 (IOI13_robots) C++14
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
//#include "robots.h"
using namespace std;
void speed()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
struct cell
{
    int w,s;
    bool operator<(const cell&a1)const
    {
        return s<a1.s;
    }
};
bool cmp(cell a1,cell a2)
{
    return a1.w<a2.w;
}
int n,m,t,a[1000005],b[1000005];
cell c[1000005];
priority_queue<cell>q;
bool check(int h)
{
    int j=1;
    for(int i=1;i<=n;i++)
    {
        while(c[j].w<a[i]&&j<=t)
        {
            q.push(c[j]);
            j++;
        }
        int g=h;
        while(g&&!q.empty())
        {
            q.pop();
            g--;
        }
    }
    for(;j<=t;j++)q.push(c[j]);
    for(int i=m;i>=1;i--)
    {
        int g=h;
        if(!q.empty()&&q.top().s>=b[i])return false;
        while(g&&!q.empty())
        {
            g--;
            q.pop();
        }
    }
    if(!q.empty())return false;
    return true;
}
int putaway(int n,int m,int t,int a[],int b[],int w[],int s[])
//void read()
{
    //cin>>n>>m>>t;
    for(int i=1;i<=n;i++)
    {
        //cin>>a[i];
    }
    sort(a+1,a+n+1);
    for(int i=1;i<=m;i++)
    {
        //cin>>b[i];
    }
    sort(b+1,b+m+1);
    int p=0;
    for(int i=1;i<=t;i++)
    {
        //cin>>c[i].w>>c[i].s;
        c[i].w=w[i];
        c[i].s=s[i];
        if(c[i].w>=a[n]&&c[i].s>=b[m])p=1;
    }
    if(p)
    {
        //cout<<-1<<endl;
        return -1;
    }
    sort(c+1,c+t+1,cmp);
    int l=1,r=t,mi;
    while(l<=r)
    {
        mi=(l+r)/2;
        if(check(mi))r=mi-1;
        else l=mi+1;
        //cout<<l<<" "<<r<<endl;
    }
    //cout<<l<<endl;
    return l;
}
/*int main()
{
    speed();
    read();
    return 0;
}
*/

Compilation message

/usr/bin/ld: /tmp/cccdrTUR.o: in function `main':
grader.c:(.text.startup+0x1b1): undefined reference to `putaway'
collect2: error: ld returned 1 exit status