제출 #386272

#제출 시각아이디문제언어결과실행 시간메모리
386272jjang36524로봇 (IOI13_robots)C++14
0 / 100
7 ms8940 KiB
#include "robots.h" #include <algorithm> #include <queue> #include <vector> #include <string.h> using namespace std; vector<int>Wl[100000]; vector<int>Sl[100000]; int us[1000100]; int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { sort(X,X+A); sort(Y,Y+B); int i; for(i=0;i<T;i++) { int x=upper_bound(X,X+A,W[i])-X; int y=upper_bound(Y,Y+B,S[i])-Y; if(x==A&&y==B) { return -1; } Wl[x].push_back(i); Sl[y].push_back(i); } int s=1; int e=T; while(s!=e) { int m=(s+e)/2; priority_queue<pair<int,int>>tc; memset(us,0,sizeof(us)); int i; for(i=0;i<A;i++) { int j; for(j=0;j<Wl[i].size();j++) { tc.push({S[Wl[i][j]],Wl[i][j]}); } for(j=0;j<m;j++) { if(tc.empty()) break; auto a=tc.top(); tc.pop(); us[a.second]=1; } } int c=0; for(i=0;i<B;i++) { int j; for(j=0;j<Sl[i].size();j++) { if(!us[Sl[i][j]]) { c++; } } c=max(0,c-m); } if(c) s=m+1; else e=m; } return s; }

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

robots.cpp: In function 'int putaway(int, int, int, int*, int*, int*, int*)':
robots.cpp:37:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |             for(j=0;j<Wl[i].size();j++)
      |                     ~^~~~~~~~~~~~~
robots.cpp:55:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |             for(j=0;j<Sl[i].size();j++)
      |                     ~^~~~~~~~~~~~~
#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...