제출 #1069425

#제출 시각아이디문제언어결과실행 시간메모리
1069425allin27x로봇 (IOI13_robots)C++17
0 / 100
1 ms4444 KiB
#include <bits/stdc++.h>
#include "robots.h"
using namespace std;

int putaway(int a, int b, int t, int X[], int Y[], int W[], int S[]){
    for (int i=0; i<a; i++) X[i]++; for (int i=0; i<b; i++) Y[i]++;
    sort(X, X+a); sort(Y, Y+b);
    sort(W, W+t);
    if (W[t-1] > X[a-1]) return -1;
    int mc = a-1; int toy = t-1; int cnt = 0;
    vector<int> exc(a, 0);
    while (mc){
        while (X[mc-1] < W[toy]) toy--, cnt++;
        exc[mc] = cnt; cnt = 0; mc--;
    }
    exc[mc] = toy+1;
    // for (int i=0; i<a; i++) cout<<exc[i]<<' ';
    int ans = 1;
    for (int i=a-2; i>=0; i--) exc[i] = exc[i+1]+exc[i];
    for (int i=0; i<a; i++) ans = max(ans, (exc[i]+a-1-i)/(a-i));

    return ans;
}
/*
5
0
9
9 16 15 20 35
1 0
2 0
3 0
5 0
8 0
12 0
14 0
19 0
20 0
*/

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

robots.cpp: In function 'int putaway(int, int, int, int*, int*, int*, int*)':
robots.cpp:6:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
    6 |     for (int i=0; i<a; i++) X[i]++; for (int i=0; i<b; i++) Y[i]++;
      |     ^~~
robots.cpp:6:37: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
    6 |     for (int i=0; i<a; i++) X[i]++; for (int i=0; i<b; i++) Y[i]++;
      |                                     ^~~
#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...