답안 #144443

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
144443 2019-08-16T21:27:44 Z youssefbou62 로봇 (APIO13_robots) C++14
컴파일 오류
0 ms 0 KB
#include  <bits/stdc++.h>
#include "robots.h"
using namespace std;

#define mp make_pair
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define allarr(a) a , a + n
#define ll long long
#define ull unsigned long long 
#define pb push_back
#define fastio ios_base::sync_with_stdio(false) ; cin.tie(NULL); cout.tie(NULL)
typedef pair<int, int> pi;
typedef pair<ll,ll> pll; 
typedef pair<int,pi> trp ;
typedef vector<pi> vpi;
typedef vector<pll> vpll ;
// int ab  (int  x ) { return (x>0?x:-x); }
int putaway(int A, int B, int T,int X[], int Y[], int W[], int S[]){
	int l = 0 , r = T; 
	sort(X,X+A); 
	sort(Y,Y+B); 
	vector<vector<int>> ByWei,BySi; 
	for(int i = 0 ; i < T ; i++ ){
		ByWei.pb({W[i],S[i],i}); 
		BySi.pb({S[i],W[i],i}); 
	}
	sort(all(ByWei)); 
	sort(all(BySi)); 
	int ans = -1 ; 
	while ( l <= r ){
		int mid = l + (r-l)/2; 
		bool done[T]={0}; 
		cerr << "**********FOR "<<mid <<" MINUTES***********"<< endl; 
		// for(int i = 0 ; i < T ; i++ )cout << done[i]<<endl; 
		priority_queue<pi> q; 
		int i = 0 ; 
		for(int a=0;a<A;a++){
			while(ByWei[i][0]<X[a]){
					q.push({ByWei[i][1],ByWei[i][2]}); 
				i++; 
			}
			int mins = mid;
			cerr << "robot Weak "<<a<<endl; 
			while(mins&&!q.empty()){
				pi p = q.top(); 
				q.pop();
				if(!done[p.se]){
					done[p.se]=1; 
					mins--;  
					cerr <<"got this "<<p.se<<endl; 
				}
			}
		}
		while(!q.empty())q.pop();  
		i =0;
			// for(auto v : BySi)cout << v[0]<<" " <<v[1]<<" " <<v[2]<<endl; 
		for(int b=0;b<B;b++){
			while(BySi[i][0]<Y[b]){
					q.push({BySi[i][1],BySi[i][2]}); 
				i++; 
			}
			int mins = mid;
			cerr << "robot Small "<<b<<endl; 
			while(mins&&!q.empty()){
				pi p = q.top(); 
				q.pop();
					// cerr << "got this "<<p.se<<endl; 
				if(!done[p.se]){
					cerr << "got this "<<p.se<<endl; 
					done[p.se]=1; 
					mins--; 
				} 
			}
		}
		bool doneAll =1; 
		for(int i = 0 ; i < T ; i++ )doneAll = doneAll&&done[i]; 
		for(int i = 0 ; i < T ; i++ )cout<<done[i]; 
		cout <<endl; 
		if( doneAll ){
			ans = mid ; 
			r = mid-1; 
		}else {
			l = mid+1; 
		}
	}
	return ans ;
}

// int main(){
// 	int A , B , T ; 
// 	cin >> A >> B >> T ; 

// 	int X[A] , Y[B] , W[T] , S[T] ; 

// 	for(int i = 0 ; i < A ; i++ )cin >> X[i]; 
// 	for(int i = 0 ; i < B ; i++ )cin >> Y[i]; 
// 	for(int i = 0 ; i < T ; i++ ){
// 		cin >> W[i] >> S[i] ;
// 	}
// 	cout << putaway(A,B,T,X,Y,W,S); 
// }

Compilation message

robots.cpp:2:10: fatal error: robots.h: No such file or directory
 #include "robots.h"
          ^~~~~~~~~~
compilation terminated.