Submission #933394

#TimeUsernameProblemLanguageResultExecution timeMemory
933394PoPularPlusPlusRobots (IOI13_robots)C++17
Compilation error
0 ms0 KiB
#include "robots.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) x.begin(),x.end()
#define vf first 
#define vs second
const int mod = 1000000007;

mt19937_64 RNG(chrono::steady_clock::now().time_since_epoch().count());

int pathway(int n,int m, int t,
vector<int> weak,vector<int> small, vector<int> w ,vector<int> s){
	/int l = 1 , r = t;
	vector<pair<int,int>> v;
	for(int i = 0; i < t; i++){
		v.pb(mp(s[i],w[i]));
	}
	sort(all(v));
	sort(all(small));
	sort(all(weak));
	int ans = -1;
	while(l <= r){
		int mid = (l + r)/2;
		priority_queue<pair<int,int>> pq;
		int j = 0;
		for(int i = 0; i < m; i++){
			while(j < t && v[j].vf < small[i]){
				pq.push(mp(v[j].vs,v[j].vf));
				j++;
			}
			int cnt = 0;
			while(cnt < mid && pq.size()){
				pq.pop();
				cnt++;
			}
		}
		while(j < t){
			pq.push(mp(v[j].vs,v[j].vf));
			j++;
		}
		vector<pair<int,int>> elements;
		while(pq.size()){
			elements.pb(pq.top());
			pq.pop();
		}
		for(auto it :elements){
			pq.push(it);
		}
		for(int i = n - 1; i >= 0; i--){
			int cnt = 0;
			while(cnt < mid && pq.size() && pq.top().vf < weak[i]){
				cnt++;
				pq.pop();
			}
		}
		if(pq.size() == 0){
			ans = mid;
			r = mid - 1;
		}
		else l = mid + 1;
	}
	return ans;
}

void solve(){
	/*int n , m , t;
	cin >> n >> m >> t;
	int weak[n] , small[m];
	for(int i = 0; i < n; i++)
		cin >> weak[i];
	for(int i = 0; i < m; i++)
		cin >> small[i];
	int w[t],s[t];
	for(int i = 0; i < t; i++)
		cin >> w[i] >> s[i];
	cout << ans << "\n";*/
}
/*
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//int t;cin>>t;
	//while(t--)
		solve();
	return 0;
}*/

Compilation message (stderr)

robots.cpp: In function 'int pathway(int, int, int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
robots.cpp:16:2: error: expected primary-expression before '/' token
   16 |  /int l = 1 , r = t;
      |  ^
robots.cpp:16:3: error: expected primary-expression before 'int'
   16 |  /int l = 1 , r = t;
      |   ^~~
robots.cpp:25:8: error: 'l' was not declared in this scope
   25 |  while(l <= r){
      |        ^
robots.cpp:25:13: error: 'r' was not declared in this scope
   25 |  while(l <= r){
      |             ^