제출 #585855

#제출 시각아이디문제언어결과실행 시간메모리
585855Dan4Life로봇 (IOI13_robots)C++17
14 / 100
270 ms19776 KiB
#include "robots.h" #include <bits/stdc++.h> using namespace std; #define pb push_back #define pii pair<int,int> #define fi first #define se second #define all(a) a.begin(), a.end() #define sz(a) (int)a.size() const int INF = (int)1e9; vector<pii> weak, small, toy; bool work(int i, int j, int type){ if(type==0) return weak[i].fi>toy[j].fi; return small[i].se>toy[j].se; } bool chk(int x){ int j = -1, cnt = 0; bool ok = true; for(int i = 0; i < sz(toy); i++){ if(i%x==0) j++; ok&=(work(j,i,0)); } return ok; } int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { for(int i = 0; i < A; i++) weak.pb({X[i],INF}); for(int i = 0; i < B; i++) small.pb({INF,Y[i]}); for(int i = 0; i < T; i++) toy.pb({W[i],S[i]}); sort(all(weak)), sort(all(small)), sort(all(toy)); reverse(all(weak)), reverse(all(small)), reverse(all(toy)); if(!work(0,0,0)) return -1; int l = (T+A-1)/A, r = T; while(l<r){ int mid = (l+r)/2; if(chk(mid)) r=mid; else l=mid+1; } return l; }

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

robots.cpp: In function 'bool chk(int)':
robots.cpp:19:17: warning: unused variable 'cnt' [-Wunused-variable]
   19 |     int j = -1, cnt = 0; bool ok = true;
      |                 ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...