제출 #931278

#제출 시각아이디문제언어결과실행 시간메모리
931278AlphaMale06로봇 (IOI13_robots)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #define F first #define S second #define pb push_back using namespace std; int putaway(int n, int m, int S, int a[], int b[], int w[], int s[]) { pair<int, int> p[S]; for(int i=0; i< S; i++)p[i]={w[i], s[i]}; sort(p, p+S); sort(a, a+n); sort(b, b+m); for(int i=0; i< n; i++)a[i]--; for(int i=0; i< m; i++)b[i]--; int ans=1e9; int l=0, r = S; while(l<=r){ int s=l+r>>1; multiset<int> st; int pt=0; for(int i=0; i< n; i++){ while(pt<S && p[pt].F<=a[i]){ st.insert(p[pt].S); pt++; } if(st.size()<=s){ st.clear(); continue; } for(int j=0; j<s; j++){ st.erase(st.find((*st.rbegin()))); } } while(pt<S){ st.insert(p[pt].S); pt++; } vector<int> v; for(auto p : st)v.pb(p); for(int i = m-1; i>=0; i--){ for(int j=0; j<s; j++){ if(v.size()){ if(v.back()<=b[i]){ v.pop_back(); } else break; } else break; } } if(v.size()){ l=s+1; } else{ r=s-1; ans=s; } } if(ans==1e9)return -1; return ans; }

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

robots.cpp: In function 'int putaway(int, int, int, int*, int*, int*, int*)':
robots.cpp:20:16: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   20 |         int s=l+r>>1;
      |               ~^~
robots.cpp:28:25: warning: comparison of integer expressions of different signedness: 'std::multiset<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   28 |             if(st.size()<=s){
      |                ~~~~~~~~~^~~
/usr/bin/ld: /tmp/cc5Km0cV.o: in function `main':
grader.c:(.text.startup+0x1b1): undefined reference to `putaway'
collect2: error: ld returned 1 exit status