Submission #592480

#TimeUsernameProblemLanguageResultExecution timeMemory
592480snasibov05Robots (IOI13_robots)C++14
28 / 100
586 ms27876 KiB
#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[]) { if (b == 0){ multiset<int> st; for (int i = 0; i < t; ++i) st.insert(w[i]); sort(x, x + a); reverse(x, x + a); int ans = 0; while (!st.empty()){ ans++; for (int i = 0; i < a; ++i){ auto it = st.lower_bound(x[i]); if (it == st.begin()){ if (i == 0) return -1; else break; } it--; st.erase(it); } } return ans; } else if (a == 0){ if (min(s[0], s[1]) < min(y[0], y[1]) && max(s[0], s[1]) < max(y[0], y[1])) return 1; else if (max(s[0], s[1]) >= max(y[0], y[1])) return -1; else return 2; } else if (a == 1){ if ((w[0] < x[0] && s[1] < y[0]) || (w[1] < x[0] && s[0] < y[0])) return 1; else if ((w[0] >= x[0] && s[0] >= y[0]) || (w[1] >= x[0] && s[1] >= y[0])) return -1; else return 2; } else{ if (min(w[0], w[1]) < min(x[0], x[1]) && max(w[0], w[1]) < max(x[0], x[1])) return 1; else if (max(w[0], w[1]) >= max(x[0], x[1])) return -1; else return 2; } }
#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...