Submission #165768

#TimeUsernameProblemLanguageResultExecution timeMemory
165768crushteacherswifeRobots (IOI13_robots)C++14
Compilation error
0 ms0 KiB
//Rochy'.' #include <bits/stdc++.h> #define fo(i,a,b) for(int i=a;i<=b;++i) #define fd(i,a,b) for(int i=a;i>=b;--i) #define fl(i,a,b) for(int i=a;i<b;++i) #define fa(i,a) for(auto i:a) #define ii pair <int,int> #define vi vector <int> #define F first #define S second #define pb push_back #define mp make_pair #define all(a) a.begin(),a.end() using namespace std; template <typename T> inline void read(T &x){char c;bool nega=0;while((!isdigit(c=getchar()))&&(c!='-')); if(c=='-'){nega=1;c=getchar();}x=c-48;while(isdigit(c=getchar()))x=x*10+c-48;if(nega)x=-x;} template <typename T> inline void writep(T x){if(x>9)writep(x/10);putchar(x%10+48);} template <typename T> inline void write(T x){if(x<0){putchar('-');x=-x;}writep(x);putchar(' ');} template <typename T> inline void writeln(T x){write(x);putchar('\n');} template <typename R, typename D> inline void Min(R &a, D b){if(a>b) a=b;} template <typename D, typename R> inline void Max(D &a, R b){if(a<b) a=b;} const int N=1000006; int n,m,item,a[N]; ii b[N]; bool check(int x){ int run=1,times; priority_queue <int> Q; fo(i,1,n){ while(b[run].F<a[i]&&run<=item){ Q.push(b[run].S); ++run; } times=x; while(Q.size()&&times){ Q.pop(); --times; } } while(run<=item){Q.push(b[run].S);++run;} fo(i,n+1,n+m){ times=x; while(Q.size()&&times) if(Q.top()<a[i]){ Q.pop(); --times; }else break; } return Q.empty(); } int main(){ ios_base::sync_with_stdio(NULL); cin. tie(NULL); cout. tie(NULL); // freopen("Robots.inp" , "r", stdin); // freopen("Robots.out", "w", stdout); read(n);read(m);read(item); fo(i,1,n+m) read(a[i]); sort(a+1,a+1+n); sort(a+1+n,a+n+m+1,greater<int>()); fo(i,1,item){read(b[i].F);read(b[i].S);} sort(b+1,b+1+item); int r=item+1; int l=0; while(r-l>1){ int mid=l+r>>1; if(check(mid)) r=mid; else l=mid; } if(r==item+1) write(-1); else write(r); return 0; }

Compilation message (stderr)

robots.cpp: In function 'int main()':
robots.cpp:65:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   int mid=l+r>>1;
           ~^~
/tmp/ccjkTvSl.o: In function `main':
robots.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/cc8Ze2M9.o:grader.c:(.text.startup+0x0): first defined here
/tmp/cc8Ze2M9.o: In function `main':
grader.c:(.text.startup+0x17e): undefined reference to `putaway'
collect2: error: ld returned 1 exit status