Submission #82020

#TimeUsernameProblemLanguageResultExecution timeMemory
82020zoooma13Robots (IOI13_robots)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define MAX_T 1000006 #define MAX_A 50004 #define We first #define Si second int A ,B ,T; int Weak[MAX_A]; int Small[MAX_A]; pair <int ,int> Toy[MAX_T]; pair <int ,int> WeTs[MAX_T]; pair <int ,int> SiTs[MAX_T]; bool can(int X) { int Weak_ptr = 0; priority_queue <int> pq; for(int i=0; i<A; i++) { while(Weak_ptr < T && WeTs[Weak_ptr].We < Weak[i]) pq.push(WeTs[Weak_ptr++].Si); int CanHave = X; while(!pq.empty() && CanHave--) pq.pop(); } while(Weak_ptr < T) pq.push(WeTs[Weak_ptr++].Si); for(int i=B-1; ~i; i--) { int CanHave = X; while(CanHave-- && !pq.empty() && pq.top() < Small[i]) pq.pop(); } return pq.empty(); } int main() { scanf("%d%d%d",&A,&B,&T); for(int i=0; i<A; i++) scanf("%d",&Weak[i]); for(int i=0; i<B; i++) scanf("%d",&Small[i]); for(int i=0; i<T; i++) { scanf("%d%d",&Toy[i].We,&Toy[i].Si); SiTs[i] = WeTs[i] = Toy[i]; } sort(Weak ,Weak+A); sort(Small ,Small+B); sort(SiTs ,SiTs+T ,[](auto i ,auto j){return i.Si < j.Si;}); sort(WeTs ,WeTs+T ,[](auto i ,auto j){return i.We < j.We;}); int st = 1 ,en = T ,mid; while(st <= en) { mid = (st+en)>>1; if(can(mid)) en = mid-1; else st = mid+1; } cout << (en == T ? -1 : en+1) << endl; }

Compilation message (stderr)

robots.cpp: In function 'int main()':
robots.cpp:47:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d%d",&A,&B,&T);
     ~~~~~^~~~~~~~~~~~~~~~~~~
robots.cpp:49:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&Weak[i]);
         ~~~~~^~~~~~~~~~~~~~~
robots.cpp:51:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&Small[i]);
         ~~~~~^~~~~~~~~~~~~~~~
robots.cpp:54:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d",&Toy[i].We,&Toy[i].Si);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/ccFFwECN.o: In function `main':
robots.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccFlc4lD.o:grader.c:(.text.startup+0x0): first defined here
/tmp/ccFlc4lD.o: In function `main':
grader.c:(.text.startup+0x17e): undefined reference to `putaway'
collect2: error: ld returned 1 exit status