제출 #897951

#제출 시각아이디문제언어결과실행 시간메모리
897951Sir_Ahmed_Imran로봇 (IOI13_robots)C++17
90 / 100
3063 ms29736 KiB
///~~~LOTA~~~/// #include "robots.h" #include <bits/stdc++.h> using namespace std; #define nl '\n' #define ff first #define ss second #define ll long long #define append push_back #define pii pair<int,int> #define all(x) (x).begin(),(x).end() bool check(int t,vector<pii>& v,multiset<int>& a,multiset<int>& b,int d){ map<int,int> A,B; for(auto& i:a) A[i]+=d; for(auto& i:b) B[i]+=d; int x; for(int i=t-1;i>=0;i--){ x=(*B.upper_bound(v[i].ss)).ff; if(x!=INT_MAX){ B[x]--; if(B[x]==0) B.erase(B.upper_bound(v[i].ss)); continue; } x=(*A.upper_bound(v[i].ff)).ff; if(x!=INT_MAX){ A[x]--; if(A[x]==0) A.erase(A.upper_bound(v[i].ff)); continue; } return 0; } return 1; } int putaway(int n,int m,int t,int x[],int y[],int w[],int s[]){ int mx,my; vector<pii> v; multiset<int> a,b; a.insert(INT_MAX); b.insert(INT_MAX); for(int i=mx=0;i<n;i++){ a.insert(x[i]); mx=max(mx,x[i]); } for(int i=my=0;i<m;i++){ b.insert(y[i]); my=max(my,y[i]); } for(int i=0;i<t;i++){ v.append({w[i],s[i]}); if(w[i]>=mx && s[i]>=my) return -1; } sort(all(v)); int o=0; for(int i=524288;i>0;i/=2) if(!check(t,v,a,b,o+i)) o+=i; return o+1; }
#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...