제출 #944997

#제출 시각아이디문제언어결과실행 시간메모리
944997oblantis로봇 (IOI13_robots)C++17
0 / 100
1 ms4540 KiB
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #pragma GCC optimize("O3,unroll-loops") #include <bits/stdc++.h> #define all(v) v.begin(), v.end() #define pb push_back #define ss second #define ff first #define vt vector using namespace std; typedef long long ll; typedef pair<int, int> pii; const int inf = INT_MAX; const int mod = 1e9+7; const int maxn = 5002; #include "robots.h" int putaway(int a, int b, int t, int x[], int y[], int w[], int s[]) { int l = 0, r = t + 1; vt<pii> v; map<int, int> hmt; for(int i = 0; i < a; i++){ v.pb({y[i], inf}); } for(int i = 0; i < t; i++){ v.pb({w[i], s[i]}); } sort(all(v)); set<int> hv; while(l + 1 < r){ int mid = l + (r - l) / 2; for(int i = 0; i < b; i++){ hmt[y[i]] += mid; hv.insert(y[i]); } set<int> help; bool ok = 1; for(int i = t + a - 1, cnt = 0; i >= 0; i--){ if(v[i].ss == inf){ cnt += mid; } else { help.insert(v[i].ss); if(cnt)cnt--; else { int x = *help.begin(); help.erase(help.begin()); if(hv.lower_bound(x) == hv.end()){ ok = 0; break; } x = *hv.lower_bound(x); hmt[x]--; if(hmt[x] == 0)hv.erase(x); } } } for(int i = 0; i < b; i++)hmt[y[i]] = 0; if(ok)r = mid; else l = mid; } if(r > t)return -1; return r; } //int main() { //ios_base::sync_with_stdio(0); //cin.tie(0); //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); //return 0; //}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...