Submission #383979

#TimeUsernameProblemLanguageResultExecution timeMemory
383979KeshiRobots (IOI13_robots)C++17
Compilation error
0 ms0 KiB
//In the name of God
#include <bits/stdc++.h>
#include "robots.h"
using namespace std;

typedef int ll;
typedef pair<ll, ll> pll;

const ll maxn = 5e4 + 100;
const ll maxm = 1e6 + 100;
const ll mod = 1e9 + 7;
const ll inf = 1e9;

#define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io freopen("input.txt", "r+", stdin);freopen("output.txt", "w+", stdout);
#define pb push_back
#define Mp make_pair
#define F first
#define S second
#define Sz(x) ll((x).size())
#define all(x) (x).begin(), (x).end()

ll a, b, t;
//pll ss[maxm];
vector<ll> v1[maxn], v2[maxn];
bitset<maxm> ok;

bool check(ll e, ll s[]){
	fill(ok, ok + t, 0);
	set<pll> st;
//	cout << "# " << e << "\n";
	for(ll i = 0; i < a; i++){
		for(ll j : v1[i]){
			st.insert(Mp(-s[j], j));
		}
		for(ll j = 0; j < e; j++){
			if(st.empty()) break;
			//cout << "! " << i << " -> " << st.begin()->S << "\n";
			ok[st.begin()->S] = 1;
			st.erase(st.begin());
		}
	}
	ll cnt = 0;
	for(ll i = 0; i < b; i++){
		for(ll j : v2[i]){
			if(!ok[j]) cnt++;
		}
		cnt = max(cnt - e, 0);
	}
	for(ll j : v2[b]){
		if(!ok[j]) cnt++;
	}
	return (cnt == 0);
}

int putaway(int A, int B, int T, int x[], int y[], int w[], int s[]) {
	a = A;
	b = B;
	t = T;
	sort(x, x + a);
	sort(y, y + b);
	for(ll i = 0; i < t; i++){
		w[i] = upper_bound(x, x + a, w[i]) - x;
		s[i] = upper_bound(y, y + b, s[i]) - y;
		if(w[i] >= a && s[i] >= b) return -1;
		//cout << i << ": " << w[i] << " " << s[i] << "\n";
		//ss[i] = Mp(s[i], i);
		v1[w[i]].pb(i);
		v2[s[i]].pb(i);
	}
	/*sort(ss, ss + t);
	for(ll i = 0; i < t; i++){
		v1[w[ss[i].S]].pb(ss[i].S);
	}*/
	ll l = 0, r = t, mid;
	while(r - l > 1){
		mid = (l + r) >> 1;
		if(check(mid, s)) r = mid;
		else l = mid;
	}
	return r;
}

/*int main(){
    freopen("sample1.in", "r", stdin);
	int A, B, T, X[100], Y[100], W[100], S[100];
	cin >> A >> B >> T;
	for(ll i = 0; i < A; i++){
		cin >> X[i];
	}
	for(ll i = 0; i < B; i++){
		cin >> Y[i];
	}
	for(ll i = 0; i < T; i++){
		cin >> W[i] >> S[i];
	}
	cout << putaway(A, B, T, X, Y, W, S);


    return 0;
}*/

Compilation message (stderr)

robots.cpp: In function 'bool check(ll, ll*)':
robots.cpp:29:14: error: no match for 'operator+' (operand types are 'std::bitset<1000100>' and 'll' {aka 'int'})
   29 |  fill(ok, ok + t, 0);
      |           ~~ ^ ~
      |           |    |
      |           |    ll {aka int}
      |           std::bitset<1000100>
In file included from /usr/include/c++/9/bits/stl_algobase.h:67,
                 from /usr/include/c++/9/bits/specfun.h:45,
                 from /usr/include/c++/9/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:41,
                 from robots.cpp:2:
/usr/include/c++/9/bits/stl_iterator.h:423:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename std::reverse_iterator<_Iterator>::difference_type, const std::reverse_iterator<_Iterator>&)'
  423 |     operator+(typename reverse_iterator<_Iterator>::difference_type __n,
      |     ^~~~~~~~
/usr/include/c++/9/bits/stl_iterator.h:423:5: note:   template argument deduction/substitution failed:
robots.cpp:29:16: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and 'll' {aka 'int'}
   29 |  fill(ok, ok + t, 0);
      |                ^
In file included from /usr/include/c++/9/bits/stl_algobase.h:67,
                 from /usr/include/c++/9/bits/specfun.h:45,
                 from /usr/include/c++/9/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:41,
                 from robots.cpp:2:
/usr/include/c++/9/bits/stl_iterator.h:1219:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename std::move_iterator<_IteratorL>::difference_type, const std::move_iterator<_IteratorL>&)'
 1219 |     operator+(typename move_iterator<_Iterator>::difference_type __n,
      |     ^~~~~~~~
/usr/include/c++/9/bits/stl_iterator.h:1219:5: note:   template argument deduction/substitution failed:
robots.cpp:29:16: note:   mismatched types 'const std::move_iterator<_IteratorL>' and 'll' {aka 'int'}
   29 |  fill(ok, ok + t, 0);
      |                ^
In file included from /usr/include/c++/9/string:55,
                 from /usr/include/c++/9/bits/locale_classes.h:40,
                 from /usr/include/c++/9/bits/ios_base.h:41,
                 from /usr/include/c++/9/ios:42,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from robots.cpp:2:
/usr/include/c++/9/bits/basic_string.h:6020:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 6020 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/basic_string.h:6020:5: note:   template argument deduction/substitution failed:
robots.cpp:29:16: note:   'std::bitset<1000100>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
   29 |  fill(ok, ok + t, 0);
      |                ^
In file included from /usr/include/c++/9/string:56,
                 from /usr/include/c++/9/bits/locale_classes.h:40,
                 from /usr/include/c++/9/bits/ios_base.h:41,
                 from /usr/include/c++/9/ios:42,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from robots.cpp:2:
/usr/include/c++/9/bits/basic_string.tcc:1158:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 1158 |     operator+(const _CharT* __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/basic_string.tcc:1158:5: note:   template argument deduction/substitution failed:
robots.cpp:29:16: note:   mismatched types 'const _CharT*' and 'std::bitset<1000100>'
   29 |  fill(ok, ok + t, 0);
      |                ^
In file included from /usr/include/c++/9/string:56,
                 from /usr/include/c++/9/bits/locale_classes.h:40,
                 from /usr/include/c++/9/bits/ios_base.h:41,
                 from /usr/include/c++/9/ios:42,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from robots.cpp:2:
/usr/include/c++/9/bits/basic_string.tcc:1174:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 1174 |     operator+(_CharT __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/9/bits/basic_string.tcc:1174:5: note:   template argument deduction/substitution failed:
robots.cpp:29:16: note:   mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'll' {aka 'int'}
   29 |  fill(ok, ok + t, 0);
      |                ^
In file included from /usr/include/c++/9/string:55,
                 from /usr/include/c++/9/bits/locale_classes.h:40,
                 from /usr/include/c++/9/bits/ios_base.h:41,
                 from /usr/include/c++/9/ios:42,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from robots.cpp:2:
/usr/include/c++/9/bits/basic_string.h:6057:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
 6057 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/basic_string.h:6057:5: note:   template argument deduction/substitution failed:
robots.cpp:29:16: note:   'std::bitset<1000100>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
   29 |  fill(ok, ok + t, 0);
      |                ^
In file included from /usr/include/c++/9/string:55,
                 from /usr/include/c++/9/bits/locale_classes.h:40,
                 from /usr/include/c++/9/bits/ios_base.h:41,
                 from /usr/include/c++/9/ios:42,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from robots.cpp:2:
/usr/include/c++/9/bits/basic_string.h:6073:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)'
 6073 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)
      |     ^~~~~~~~
/usr/include/c++/9/bits/basic_string.h:6073:5: note:   template argument deduction/substitution failed:
robots.cpp:29:16: note:   'std::bitset<1000100>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
   29 |  fill(ok, ok + t, 0);
      |                ^
In file included from /usr/include/c++/9/string:55,
                 from /usr/include/c++/9/bits/locale_classes.h:40,
                 from /usr/include/c++/9/bits/ios_base.h:41,
                 from /usr/include/c++/9/ios:42,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from robots.cpp:2:
/usr/include/c++/9/bits/basic_string.h:6085:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 6085 |     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/basic_string.h:6085:5: note:   template argument deduction/substitution failed:
robots.cpp:29:16: note:   'std::bitset<1000100>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
   29 |  fill(ok, ok + t, 0);
      |                ^
In file included from /usr/include/c++/9/string:55,
                 from /usr/include/c++/9/bits/locale_classes.h:40,
                 from /usr/include/c++/9/bits/ios_base.h:41,
                 from /usr/include/c++/9/ios:42,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from robots.cpp:2:
/usr/include/c++/9/bits/basic_string.h:6091:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
 6091 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/basic_string.h:6091:5: note:   template argument deduction/substitution failed:
robots.cpp:29:16: note:   'std::bitset<1000100>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
   29 |  fill(ok, ok + t, 0);
      |                ^
In file included from /usr/include/c++/9/string:55,
                 from /usr/include/c++/9/bits/locale_classes.h:40,
                 from /usr/include/c++/9/bits/ios_base.h:41,
                 from /usr/include/c++/9/ios:42,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from robots.cpp:2:
/usr/include/c++/9/bits/basic_string.h:6097:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
 6097 |     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/basic_string.h:6097:5: note:   template argument deduction/substitution failed:
robots.cpp:29:16: note:   'std::bitset<1000100>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
   29 |  fill(ok, ok + t, 0);
      |                ^
In file included from /usr/include/c++/9/string:55,
                 from /usr/include/c++/9/bits/locale_classes.h:40,
                 from /usr/include/c++/9/bits/ios_base.h:41,
                 from /usr/include/c++/9/ios:42,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from robots.cpp:2:
/usr/include/c++/9/bits/basic_string.h:6109:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
 6109 |     operator+(const _CharT* __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/basic_string.h:6109:5: note:   template argument deduction/substitution failed:
robots.cpp:29:16: note:   mismatched types 'const _CharT*' and 'std::bitset<1000100>'
   29 |  fill(ok, ok + t, 0);
      |                ^
In file included from /usr/include/c++/9/string:55,
                 from /usr/include/c++/9/bits/locale_classes.h:40,
                 from /usr/include/c++/9/bits/ios_base.h:41,
                 from /usr/include/c++/9/ios:42,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from robots.cpp:2:
/usr/include/c++/9/bits/basic_string.h:6115:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
 6115 |     operator+(_CharT __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/basic_string.h:6115:5: note:   template argument deduction/substitution failed:
robots.cpp:29:16: note:   mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'll' {aka 'int'}
   29 |  fill(ok, ok + t, 0);
      |                ^
In file included from /usr/include/c++/9/string:55,
                 from /usr/include/c++/9/bits/locale_classes.h:40,
                 from /usr/include/c++/9/bits/ios_base.h:41,
                 from /usr/include/c++/9/ios:42,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from robots.cpp:2:
/usr/include/c++/9/bits/basic_string.h:6121:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const _CharT*)'
 6121 |     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/basic_string.h:6121:5: note:   template argument deduction/substitution failed:
robots.cpp:29:16: note:   'std::bitset<1000100>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
   29 |  fill(ok, ok + t, 0);
      |                ^
In file included from /usr/include/c++/9/string:55,
                 from /usr/include/c++/9/bits/locale_classes.h:40,
                 from /usr/include/c++/9/bits/ios_base.h:41,
                 from /usr/include/c++/9/ios:42,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from robots.cpp:2:
/usr/include/c++/9/bits/basic_string.h:6127:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, _CharT)'
 6127 |     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/basic_string.h:6127:5: note:   template argument deduction/substitution failed:
robots.cpp:29:16: note:   'std::bitset<1000100>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
   29 |  fill(ok, ok + t, 0);
      |                ^
In file included from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from robots.cpp:2:
/usr/include/c++/9/complex:327:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator+(const std::complex<_Tp>&, const std::complex<_Tp>&)'
  327 |     operator+(const complex<_Tp>& __x, const complex<_Tp>& __y)
      |     ^~~~~~~~
/usr/include/c++/9/complex:327:5: note:   template argument deduction/substitution failed:
robots.cpp:29:16: note:   'std::bitset<1000100>' is not derived from 'const std::complex<_Tp>'
   29 |  fill(ok, ok + t, 0);
      |                ^
In file included from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from robots.cpp:2:
/usr/include/c++/9/complex:336:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator+(const std::complex<_Tp>&, const _Tp&)'
  336 |     operator+(const complex<_Tp>& __x, const _Tp& __y)
      |     ^~~~~~~~
/usr/include/c++/9/complex:336:5: note:   template argument deduction/substitution failed:
robots.cpp:29:16: note:   'std::bitset<1000100>' is not derived from 'const std::complex<_Tp>'
   29 |  fill(ok, ok + t, 0);
      |                ^
In file included from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from robots.cpp:2:
/usr/include/c++/9/complex:345:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator+(const _Tp&, const std::complex<_Tp>&)'
  345 |     operator+(const _Tp& __x, const complex<_Tp>& __y)
      |     ^~~~~~~~
/usr/include/c++/9/complex:345:5: note:   template argument deduction/substitution failed:
robots.cpp:29:16: note:   mismatched types 'const std::complex<_Tp>' and 'll' {aka 'int'}
   29 |  fill(ok, ok + t, 0);
      |                ^
In file included from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from robots.cpp:2:
/usr/include/c++/9/complex:446:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator+(const std::complex<_Tp>&)'
  446 |     operator+(const complex<_Tp>& __x)
      |     ^~~~~~~~
/usr/include/c++/9/complex:446:5: note:   template argument deduct