이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "robots.h"
#include<bits/stdc++.h>
#define ff first
#define ss second
using namespace std;
int a, b, t;
vector<int>bb[500005];
bool solve(int s){
int num[500005]={0};
for (int i=1;i<=a;i++){
for (int j=0;j<bb[i].size()-s;j++){
num[bb[i][j]]++;
}
}
for (int i=0;i<bb[a+1].size();i++)num[bb[a+1][i]]++;
long long cur=0;
for (int i=b;i>=1;i--){
cur+=num[i];
if (cur>1LL*s*(b-i+1))return 0;
}
return 1;
}
int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]){
int x, y;
for (int i=0;i<T;i++){
int l=1, r=A;
while(true){
if (l==r){
if (X[l]<=W[i])x=l+1;
else x=l;
break;
}
int mid=(l+r)/2;
if (X[mid+1]<=W[i])l=mid+1;
else r=mid;
}
l=1;r=B;
while(true){
if (l==r){
if (Y[l]<=S[i])y=l+1;
else y=l;
break;
}
int mid=(l+r)/2;
if (Y[mid+1]<=S[i])l=mid+1;
else r=mid;
}
if (x==A+1 && y==B+1)return -1;
bb[x].push_back(y);
}
a=A;
b=B;
t=T;
for (int i=1;i<=a+1;i++)sort(bb[i].begin(), bb[i].end());
int l=1, r=T;
while(true){
if (l==r){
if (solve(l))return l;
else return l+1;
}
int mid=(l+r)/2;
if (solve(mid))l=mid+1;
else r=mid;
}
}
컴파일 시 표준 에러 (stderr) 메시지
robots.cpp: In function 'bool solve(int)':
robots.cpp:11:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
11 | for (int j=0;j<bb[i].size()-s;j++){
| ~^~~~~~~~~~~~~~~
robots.cpp:15:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
15 | for (int i=0;i<bb[a+1].size();i++)num[bb[a+1][i]]++;
| ~^~~~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |