제출 #1036441

#제출 시각아이디문제언어결과실행 시간메모리
1036441clementine로봇 (IOI13_robots)C++17
0 / 100
136 ms19852 KiB
#include "robots.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; bool can(int time, int A, vector<int> tots) { for(int i = 0; i < A; i++) { if(tots[i] > time) { tots[i+1] += tots[i] - time; } } if(tots[A] !=0) { return false; } return true; } int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { vector<int> Xs(X, X+A); vector<int> Ys(Y, Y+B); vector<int> Ws(W, W+T); vector<int> Ss(S, S + T); sort(Xs.begin(), Xs.end()); sort(Ws.begin(), Ws.end()); int x = 0; int total = 0; int i = 0; Xs.push_back(INT32_MAX); vector<int> tots; while(i!=T) { if(Ws[i] < Xs[x]) { total ++; i++; } else { tots.push_back(total); total = 0; x +=1; } } tots.push_back(total); if(tots.size() != A+1) { tots.push_back(0); } if(Xs[A-1] < Ws.back()) { return -1; } int l = 1; int r = 1000006; while(l != r) { int mid = (l + r)/2; if(can(mid, A, tots)) { r = mid; } else { l = mid + 1; } } return l; //return can(4, A, tots); }

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

robots.cpp: In function 'int putaway(int, int, int, int*, int*, int*, int*)':
robots.cpp:52:20: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   52 |     if(tots.size() != A+1)
      |        ~~~~~~~~~~~~^~~~~~
#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...