제출 #1136915

#제출 시각아이디문제언어결과실행 시간메모리
1136915mychecksedadRobots (IOI13_robots)C++20
0 / 100
0 ms328 KiB
/* Author : Mychecksdead */ #include "robots.h" #include<bits/stdc++.h> using namespace std; #define ll long long int #define MOD (1000000000+7) #define MOD1 (998244353) #define pb push_back #define all(x) x.begin(), x.end() #define en cout << '\n' #define ff first #define ss second #define pii pair<int,int> #define vi vector<int> const int N = 1e6+100, M = 1e5+10, K = 52, MX = 30; int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { int ans = -1; int l = 1, r = T; if(A>0) sort(X, X+A); if(B>0) sort(Y, Y+B); vector<array<int, 3>> x, y; for(int i = 1; i <= T; ++i){ x.pb({W[i-1], S[i-1], i-1}); y.pb({S[i-1], W[i-1], i-1}); } sort(all(x)); sort(all(y)); while(l <= r){ int m = l+r>>1; set<array<int, 3>> x2, y2; int px = 0, py = 0; vector<bool> vis(T); for(int i = 0; i < A; ++i){ while(px < T && x[px][0] < X[i]){ x2.insert(array<int, 3>{-x[px][1], x[px][0], x[px][2]}); ++px; } for(int j = 0; j < m; ++j){ if(x2.empty()) break; auto it = x2.begin(); vis[(*it)[2]] = 1; x2.erase(it); } } for(int i = 0; i < B; ++i){ while(py < T && (vis[y[py][2]] || y[py][0] < Y[i])){ if(vis[y[py][2]]){ ++py; continue; } y2.insert(array<int, 3>{-y[py][1], y[py][0], y[py][2]}); ++py; } for(int j = 0; j < m; ++j){ if(y2.empty()) break; auto it = y2.begin(); y2.erase(it); } } if(py == T && y2.empty()){ ans = m; r = m - 1; }else l = m + 1; // cout << m << '\n'; } return ans; }
#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...