Submission #993319

#TimeUsernameProblemLanguageResultExecution timeMemory
993319emad234Robots (IOI13_robots)C++17
Compilation error
0 ms0 KiB
#include "bits/stdc++.h" #define F first #define S second #define ll long long #define pii pair<int,int> const int mxN = 5e5 + 5; const int mod = 1e9 + 7; using namespace std; vector<pii>v; int w[mxN],s[mxN]; int a,b; bool solve(int m){ priority_queue<int>q; int i = 0; for(auto x : v){ if(x.F >= w[i] && i < a){ int t = m; while(t-- && q.size()) q.pop(); i++; } q.push(x.S); } for(i; i < a;i++) { int t = m; while(t-- && q.size()) q.pop(); } i = 0; for(i;i < b;i++){ int t = m; while(t-- && q.size() && q.top() < s[i]) q.pop(); } return q.empty(); } int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]){ a = A; b = B; for(int i = 0;i < A;i++) w[i] = X[i]; for(int i = 0;i < B;i++) s[i] = Y[i]; v.clear(); for(int i = 0;i < T;i++) v.push_back({W[i],S[i]}); sort(v.begin(),v.end()); int l = 1,r = T; int md; int ans = -1; while(l < r){ md = (l + r) / 2; if(solve(md)){ ans = md; r = md; }else l = md + 1; } return ans; }

Compilation message (stderr)

robots.cpp: In function 'bool solve(int)':
robots.cpp:23:9: warning: statement has no effect [-Wunused-value]
   23 |     for(i; i < a;i++) {
      |         ^
robots.cpp:28:9: warning: statement has no effect [-Wunused-value]
   28 |     for(i;i < b;i++){
      |         ^
/usr/bin/ld: /tmp/ccRVeVwT.o: in function `main':
grader.c:(.text.startup+0x1b1): undefined reference to `putaway'
collect2: error: ld returned 1 exit status