답안 #820106

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
820106 2023-08-10T19:21:08 Z nemethm 쌀 창고 (IOI11_ricehub) C++17
68 / 100
1000 ms 608 KB
    #include "ricehub.h"
    #include <bits/stdc++.h>
     
    using namespace std;
     
    using ll = long long int;
     
    int besthub(int R, int L, int X[], long long B)
    {
      int ans = 0;
      for(int i = 0; i < R; ++i){
        vector<int> q;
        for(int j = 0; j < R; ++j){
          q.push_back(abs(X[i] - X[j]));
        }
        sort(begin(q), end(q));
        ll cost = 0;
        int actual = 0;
        int j = 0;
        while(j < q.size() && cost + q[j] <= B){
          ++actual;
          cost += q[j];
          ++j;
        }
        ans = max(ans, actual);
      }
      return ans;
    }

Compilation message

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:20:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |         while(j < q.size() && cost + q[j] <= B){
      |               ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 2 ms 212 KB Output is correct
22 Correct 3 ms 212 KB Output is correct
23 Correct 5 ms 212 KB Output is correct
24 Correct 5 ms 212 KB Output is correct
25 Correct 5 ms 212 KB Output is correct
26 Correct 4 ms 212 KB Output is correct
27 Correct 4 ms 212 KB Output is correct
28 Correct 4 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 14 ms 316 KB Output is correct
4 Correct 14 ms 316 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 3 ms 212 KB Output is correct
7 Correct 9 ms 320 KB Output is correct
8 Correct 9 ms 212 KB Output is correct
9 Correct 5 ms 312 KB Output is correct
10 Correct 6 ms 212 KB Output is correct
11 Correct 12 ms 320 KB Output is correct
12 Correct 15 ms 320 KB Output is correct
13 Correct 19 ms 320 KB Output is correct
14 Correct 18 ms 320 KB Output is correct
15 Correct 4 ms 212 KB Output is correct
16 Correct 5 ms 212 KB Output is correct
17 Correct 11 ms 312 KB Output is correct
18 Correct 11 ms 212 KB Output is correct
19 Correct 18 ms 312 KB Output is correct
20 Correct 18 ms 320 KB Output is correct
21 Correct 281 ms 368 KB Output is correct
22 Correct 304 ms 364 KB Output is correct
23 Correct 621 ms 364 KB Output is correct
24 Correct 626 ms 392 KB Output is correct
25 Correct 581 ms 420 KB Output is correct
26 Correct 580 ms 400 KB Output is correct
27 Correct 562 ms 340 KB Output is correct
28 Correct 527 ms 412 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1070 ms 608 KB Time limit exceeded
2 Halted 0 ms 0 KB -