제출 #1064547

#제출 시각아이디문제언어결과실행 시간메모리
1064547ArthuroWich로봇 (IOI13_robots)C++17
76 / 100
3090 ms21620 KiB
#include "robots.h" #include<bits/stdc++.h> using namespace std; int n, m, t; vector<int> weak, small; vector<pair<int, int>> toy; bool check(int x) { vector<int> vis(t, 0); for (int i : weak) { int co = 0; for (int j = 0; j < t && co < x; j++) { if (vis[j] || toy[j].second >= i) { continue; } vis[j] = 1; co++; } } for (int i : small) { int co = 0; for (int j = 0; j < t && co < x; j++) { if (vis[j] || toy[j].first >= i) { continue; } vis[j] = 1; co++; } } for (int i = 0; i < t; i++) { if (vis[i]) { continue; } return 0; } return 1; } int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { n = A, m = B, t = T; for (int i = 0; i < t; i++) { toy.push_back({S[i], W[i]}); } for (int i = 0; i < n; i++) { weak.push_back(X[i]); } for (int i = 0; i < m; i++) { small.push_back(Y[i]); } int l = 1, r = T; sort(toy.rbegin(), toy.rend()); sort(weak.begin(), weak.end()); sort(small.begin(), small.end()); while(l < r) { int m = (l+r)/2; if (check(m)) { r = m; } else { l = m+1; } } if (check(l)) { return l; } else { 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...