답안 #820105

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
820105 2023-08-10T19:20:27 Z nemethm 쌀 창고 (IOI11_ricehub) C++17
0 / 100
1000 ms 3152 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]));
        }
        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:19:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |         while(j < q.size() && cost + q[j] <= B){
      |               ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 1 ms 212 KB Output is correct
6 Correct 0 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 1 ms 212 KB Output is correct
10 Correct 1 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 1 ms 212 KB Output is correct
14 Incorrect 0 ms 212 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 2 ms 212 KB Output is correct
4 Correct 2 ms 212 KB Output is correct
5 Correct 1 ms 312 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 2 ms 212 KB Output is correct
14 Correct 2 ms 212 KB Output is correct
15 Incorrect 1 ms 212 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 887 ms 632 KB Output is correct
2 Correct 889 ms 728 KB Output is correct
3 Execution timed out 1072 ms 3152 KB Time limit exceeded
4 Halted 0 ms 0 KB -