제출 #852867

#제출 시각아이디문제언어결과실행 시간메모리
852867hngwlog로봇 (IOI13_robots)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "robots.h" using namespace std; #define fi first #define se second #define _size(x) (int)x.size() #define BIT(i, x) ((x >> i) & 1) #define MASK(n) ((1 << n) - 1) #define REP(i, n) for (int i = 0, _n = (n); i < _n; i++) #define FOR(i, a, b) for (int i = a, _b = (b); i <= _b; i++) #define FORD(i, a, b) for (int i = a, _b = (b); i >= _b; i--) #define FORB1(i, mask) for (int i = mask; i > 0; i ^= i & - i) #define FORB0(i, n, mask) for (int i = ((1 << n) - 1) ^ mask; i > 0; i ^= i & - i) #define FORALL(i, a) for (auto i: a) #define fastio ios_base::sync_with_stdio(0); cin.tie(0); int putaway(int a, int b, int t, vector<int> x, vector<int> y, vector<int> w, vector<int> s) { sort(x.begin(), x.end()); sort(y.begin(), y.end()); int l = 0; int r = t + 1; while (l < r) { int mid = (l + r) / 2; vector<int> ids, used(t); REP(i, t) ids.push_back(i); sort(ids.begin(), ids.end(), [&] (const int i, int j) { return w[i] < w[j]; }); priority_queue<pair<int, int>> pq; int j = 0; FORALL(value, x) { while (j < t && w[ids[j]] < value) pq.push({s[ids[j]], ids[j++]}); int cnt = 0; while (!pq.empty() && cnt < mid) { int id = pq.top().se; pq.pop(); used[id]++; cnt++; } } vector<int> g; REP(i, t) if (!used[i]) g.push_back(s[i]); sort(g.begin(), g.end()); j = 0; FORALL(value, y) { int cnt = 0; while (j < _size(g) && cnt < mid && g[j] < value) { cnt++; j++; } } if (j == _size(g)) r = mid; else l = mid + 1; } return (l > t ? - 1 : l); }

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

robots.cpp: In function 'int putaway(int, int, int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
robots.cpp:32:73: warning: operation on 'j' may be undefined [-Wsequence-point]
   32 |             while (j < t && w[ids[j]] < value) pq.push({s[ids[j]], ids[j++]});
      |                                                                        ~^~
/usr/bin/ld: /tmp/ccLuaSrr.o: in function `main':
grader.c:(.text.startup+0x1b1): undefined reference to `putaway'
collect2: error: ld returned 1 exit status