Submission #993303

#TimeUsernameProblemLanguageResultExecution timeMemory
993303Muaath_5Robots (IOI13_robots)C++17
14 / 100
3073 ms37384 KiB
#pragma GCC optimize("Ofast") #pragma GCC target("avx2") #include "robots.h" #include <bits/stdc++.h> using namespace std; int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { sort(X, X+A); sort(Y, Y+B); vector<pair<int, int>> v; for (int i = 0; i < T; i++) v.push_back({W[i], S[i]}); sort(v.begin(), v.end()); for (int i = 0; i < T; i++) { W[i] = v[i].first, S[i] = v[i].second; if (W[i] >= X[A-1] && S[i] >= Y[B-1]) return -1; } if (T == 2 && A+B == 2) { if (A==2) { if (*max_element(X, X+A) <= *max_element(W, W+T)) return -1; if (X[0] > W[0] && X[1] > W[1]) return 1; return 2; } if (B==2) { if (*max_element(Y, Y+B) <= *max_element(S, S+T)) return -1; if (Y[0] > S[0] && Y[1] > S[1]) return 1; return 2; } if ((X[0] > W[0] && Y[0] > S[1]) || (X[0] > W[1] && Y[0] > S[0])) return 1; if ((X[0] > W[0] && X[0] > W[1]) || (Y[0] > S[0] && Y[0] > S[1])) return 2; return -1; } if (B == 0) { multiset<int> s; for (int i = 0; i < T; i++) s.insert(W[i]); int sol = 0, st = 0; while (s.size()) { for (int i = st; s.size() && i < A; i++) { auto it = s.lower_bound(X[i]); if (it == s.begin()) { st = max(st, i); continue; } it--; s.erase(it); } sol++; } return sol; } 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...