제출 #553884

#제출 시각아이디문제언어결과실행 시간메모리
553884elazarkoren로봇 (IOI13_robots)C++17
0 / 100
167 ms8400 KiB
#include "robots.h" #include <bits/stdc++.h> #define x first #define y second #define all(v) v.begin(), v.end() #define chkmin(a, b) a = min(a, b) #define chkmax(a, b) a = max(a, b) using namespace std; typedef long long ll; typedef vector<ll> vi; typedef vector<vi> vvi; typedef pair<int, int> pii; typedef vector<pii> vii; const int MAX_T = 1e6 + 1; const int MAX_A = 5e4 + 5; const int MAX_B = 5e4 + 5; int a, b, t; int x[MAX_A], y[MAX_B], w[MAX_T], s[MAX_T]; bool Ok(int time) { int ind = 0; for (int i = 0; i < a && ind < t; i++) { int j = ind + time; for (; ind < j && w[ind] < x[i]; ind++); } return ind == t; } int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { a = A, b = b, t = T; for (int i = 0; i < a; i++) x[i] = X[i]; for (int i = 0; i < b; i++) y[i] = Y[i]; for (int i = 0; i < t; i++) w[i] = W[i], s[i] = S[i]; sort(x, x + a); sort(w, w + t); int begin = 0, end = t + 1, mid; while (begin < end) { mid = (begin + end) >> 1; if (Ok(mid)) { end = mid; } else begin = mid + 1; } if (end == t + 1) return -1; return end; // vii robots; // for (int i = 0; i < a; i++) { // robots.push_back({i, 0}); // } // for (int j = 0; j < b; j++) { // robots.push_back({j, 1}); // } // for (int i = 0; i < t; i++) { // int count = 0; // for (int j = 0; j < 2; j++) { // if (robots[j].y && s[i] < y[robots[j].x]) { // good[i][j] = true; // count++; // } else if (!robots[j].y && w[i] < x[robots[j].x]) { // good[i][j] = true; // count++; // } // } // if (!count) return -1; // } // if (good[0][0] && good[1][1] || good[1][0] && good[0][1]) return 1; // return 2; } /* 3 0 6 6 2 9 4 6 8 5 7 9 1 8 5 1 8 7 */
#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...