Submission #1082379

#TimeUsernameProblemLanguageResultExecution timeMemory
1082379modwweRobots (IOI13_robots)C++17
Compilation error
0 ms0 KiB
#pragma GCC optimize("Ofast,unroll-loops")
#include<bits/stdc++.h>
//#define int long long
//#define ll long long
#define down cout<<'\n';
#define debug cout<<" cucuucucuuu",down
#define NHP     ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
#define modwwe  int t;cin>>t; while(t--)
#define bit(i,j) (i>>j&1)
#define sobit(a) __builtin_popcountll(a)
#define task "test"
#define fin(x) freopen(x".inp","r",stdin)
#define fou(x) freopen(x".ans","w",stdout)
#define pb push_back
#define checktime   cerr << (double)clock() / CLOCKS_PER_SEC * 1000  << " ms";
using namespace std;
#define getchar_unlocked getchar

inline int scan()
{
    char c = getchar_unlocked();
    int x = 0;
    while(c<'0'||c>'9')
    {
        c=getchar_unlocked();
    }
    while(c>='0'&&c<='9')
    {
        x=(x<<1)+(x<<3)+c-'0';
        c=getchar_unlocked();
    }
    return x;
}

void phongbeo();
const int inf=1e9;
const int mod2=1e9+9;
const int  mod1=998244353;
struct icd
{
    long double a;
    int b;
};
struct ib
{
    int a;
    int b;
};
struct ic
{
    int a,b,c;
};
struct id
{
    int a,b,c,d;
};
struct ie
{
    int a,b,c,d,e;

};

int n,m,s1,s4,s3,sf,k,s5,s6,mx,s7,s8,s9,mx2,res,dem2=0,dem=0,s33,dem3,dem4,l,r,mid,l2,r2;
int  i,s10,s12;
int kk;
int el=29;
main()
{
#ifndef ONLINE_JUDGE
//fin(task),fou(task);
#endif
    NHP
    /// cin>>s1;
    //modwwe
    phongbeo();
//checktime
}
vector<int> v,v2;
set<int> s;
set<int> s2;
bool c[1000001];
ib a[1000001];
unordered_map<int,int> cnt;
unordered_map<int,int> cnt2;
bool cmp(ib a,ib b)
{
    return a.b>b.b;
}
bool check(int x)
{
    for(auto f:v)
        cnt[f]=0;
    for(auto f:v2)
        cnt2[f]=0;
    for(auto f:v)
        s.insert(f),cnt[f]+=x;
    for(auto f:v2)
        s2.insert(f),cnt2[f]+=x;
    for(int i=1; i<=k; i++)
        c[i]=0;
    for(int i=1; i<=k; i++)
    {
        set<int>::iterator sx = s.lower_bound(a[i].a);
        if(sx==s.end()) continue;
        cnt[*sx]--;
        c[i]=1;
        if(cnt[*sx]==0) s.erase(sx);
    }
    for(int i=1; i<=k; i++)
    {
        if(c[i]) continue;
        set<int>::iterator sx = s2.lower_bound(a[i].b);
        if(sx==s2.end()) {
                return 0;}
        cnt2[*sx]--;
        if(cnt2[*sx]==0) s2.erase(sx);
    }
    return 1;
}
void phongbeo()
{
    cin>>n>>m>>k;
    for(int i=1; i<=n; i++)
        cin>>l,l--,v.pb(l);
    for(int i=1; i<=m; i++)
        cin>>l,l--,v2.pb(l);
    for(int i=1; i<=k; i++)
        cin>>a[i].a>>a[i].b;
    sort(a+1,a+1+k,cmp);
    l=max(1,k/(n+m));
    r=k;
while(l<=r)
{
    int mid=l+r>>1;
     if(check(mid))r=mid-1;
     else l=mid+1;
}
if(r==k) cout<<-1;
else
cout<<r+1;
}

Compilation message (stderr)

robots.cpp:67:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   67 | main()
      | ^~~~
robots.cpp: In function 'void phongbeo()':
robots.cpp:134:14: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  134 |     int mid=l+r>>1;
      |             ~^~
/usr/bin/ld: /tmp/ccjaInur.o: in function `main':
robots.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccoo4Fds.o:grader.c:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccoo4Fds.o: in function `main':
grader.c:(.text.startup+0x1b1): undefined reference to `putaway'
collect2: error: ld returned 1 exit status