제출 #933401

#제출 시각아이디문제언어결과실행 시간메모리
933401PoPularPlusPlus로봇 (IOI13_robots)C++17
컴파일 에러
0 ms0 KiB
#include "robots.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define pb(x) push_back(x) #define mp(x,y) make_pair(x,y) #define all(x) x.begin(),x.end() #define vf first #define vs second const int mod = 1000000007; mt19937_64 RNG(chrono::steady_clock::now().time_since_epoch().count()); int pathway(int n,int m, int t, weak[],small[], w[] ,s[]){ int l = 1 , r = t; vector<pair<int,int>> v; for(int i = 0; i < t; i++){ v.pb(mp(s[i],w[i])); } sort(all(v)); sort(small,small+m); sort(weak,weak+n); int ans = -1; while(l <= r){ int mid = (l + r)/2; priority_queue<pair<int,int>> pq; int j = 0; for(int i = 0; i < m; i++){ while(j < t && v[j].vf < small[i]){ pq.push(mp(v[j].vs,v[j].vf)); j++; } int cnt = 0; while(cnt < mid && pq.size()){ pq.pop(); cnt++; } } while(j < t){ pq.push(mp(v[j].vs,v[j].vf)); j++; } vector<pair<int,int>> elements; while(pq.size()){ elements.pb(pq.top()); pq.pop(); } for(auto it :elements){ pq.push(it); } for(int i = n - 1; i >= 0; i--){ int cnt = 0; while(cnt < mid && pq.size() && pq.top().vf < weak[i]){ cnt++; pq.pop(); } } if(pq.size() == 0){ ans = mid; r = mid - 1; } else l = mid + 1; } return ans; } void solve(){ /*int n , m , t; cin >> n >> m >> t; int weak[n] , small[m]; for(int i = 0; i < n; i++) cin >> weak[i]; for(int i = 0; i < m; i++) cin >> small[i]; int w[t],s[t]; for(int i = 0; i < t; i++) cin >> w[i] >> s[i]; cout << ans << "\n";*/ } /* int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); //int t;cin>>t; //while(t--) solve(); return 0; }*/

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

robots.cpp:15:1: error: 'weak' has not been declared
   15 | weak[],small[], w[] ,s[]){
      | ^~~~
robots.cpp:15:8: error: 'small' has not been declared
   15 | weak[],small[], w[] ,s[]){
      |        ^~~~~
robots.cpp:15:17: error: 'w' has not been declared
   15 | weak[],small[], w[] ,s[]){
      |                 ^
robots.cpp:15:22: error: 's' has not been declared
   15 | weak[],small[], w[] ,s[]){
      |                      ^
robots.cpp: In function 'int pathway(int, int, int, int*, int*, int*, int*)':
robots.cpp:19:11: error: 's' was not declared in this scope
   19 |   v.pb(mp(s[i],w[i]));
      |           ^
robots.cpp:5:25: note: in definition of macro 'pb'
    5 | #define pb(x) push_back(x)
      |                         ^
robots.cpp:19:8: note: in expansion of macro 'mp'
   19 |   v.pb(mp(s[i],w[i]));
      |        ^~
robots.cpp:19:16: error: 'w' was not declared in this scope
   19 |   v.pb(mp(s[i],w[i]));
      |                ^
robots.cpp:5:25: note: in definition of macro 'pb'
    5 | #define pb(x) push_back(x)
      |                         ^
robots.cpp:19:8: note: in expansion of macro 'mp'
   19 |   v.pb(mp(s[i],w[i]));
      |        ^~
robots.cpp:22:7: error: 'small' was not declared in this scope
   22 |  sort(small,small+m);
      |       ^~~~~
robots.cpp:23:7: error: 'weak' was not declared in this scope
   23 |  sort(weak,weak+n);
      |       ^~~~