Submission #1126074

#TimeUsernameProblemLanguageResultExecution timeMemory
1126074m_bezrutchkaRobots (IOI13_robots)C++20
14 / 100
424 ms30484 KiB
#include "robots.h" #include <bits/stdc++.h> using namespace std; typedef pair<int, int> pii; int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { // sub2 assert(B == 0); multiset<int> toys; for (int i = 0; i < T; i++) { toys.insert(W[i]); } multiset<int> robots; for (int i = 0; i < A; i++) { robots.insert(X[i]); } int resp = 0; while (true) { // printf("hello\n"); resp++; vector<int> to_delete_robots; for (int x: robots) { auto it = toys.lower_bound(x); if (it == toys.begin()) { to_delete_robots.push_back(x); } else { it--; toys.erase(it); } } for (int x: to_delete_robots) { // printf("deleting robot %d\n", x); robots.erase(robots.find(x)); } if (robots.empty() && !toys.empty()) return -1; if (toys.empty()) return resp; } return -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...