제출 #123743

#제출 시각아이디문제언어결과실행 시간메모리
123743turbat로봇 (IOI13_robots)C++14
컴파일 에러
0 ms0 KiB
#include "robots.h" #include <bits/stdc++.h> using namespace std; int a, b, t, *x, *y, *w, *s, cnt; unordered_multiset <int> se; pair <int, int> p[1000005]; bool can(int k){ se.clear(); int j = 0; for (int i = 0;i < a;i++){ while (j < t && p[j].first < x[i]) se.insert(s[p[j++].second]); cnt = k; while (cnt-- && !se.empty()) { auto it = se.end(); --it; se.erase(it); } } for (;j < t;j++) se.insert(s[p[j].second]); j = 0; cnt = k; // cout << k << endl; // for (auto a : se) cout << a << ' '; // cout << endl; for (auto a : se){ while (j < b && (!cnt || a >= y[j])){ j++; cnt = k; } if (j == b) return 0; cnt--; } return 1; } int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { a = A, b = B, t = T, x = X, y = Y, w = W, s = S; sort(x, x + a); sort(y, y + b); for (int i = 0;i < t;i++){ if (w[i] >= x[a - 1] && s[i] >= y[b - 1]) return -1; p[i].first = w[i]; p[i].second = i; } sort(p, p + t); // for (int i = 0;i < t;i++) // cout << p[i].first << ' '<< s[p[i].second] << endl; // for (int i = 0;i < a;i++) cout << x[i] << endl; // cout << endl; // for (int i = 0;i < b;i++) cout << y[i] << ' '; // cout << endl; int l = 1, r = t, mid; while (l != r){ mid = (l + r) / 2; if (can(mid)) r = mid; else l = mid + 1; } return l; }

컴파일 시 표준 에러 (stderr) 메시지

robots.cpp: In function 'bool can(int)':
robots.cpp:18:4: error: no match for 'operator--' (operand type is 'std::__detail::_Node_iterator<int, true, false>')
    --it;
    ^~~~