답안 #1027777

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1027777 2024-07-19T09:49:28 Z vjudge1 쌀 창고 (IOI11_ricehub) C++17
42 / 100
1000 ms 1372 KB
#include <bits/stdc++.h>
using namespace std;
int besthub(int n, int l, int x[], long long b)
{
    long long max_rez=-1, sol=1;
    for(int i=0; i<n; i++)
    {
        multiset<int>s;
        for(int j=0; j<n; j++)
        {
            s.insert(abs(x[j]-x[i]));
        }
        long long sum=0, rez=0;
        for(auto it=s.begin(); it!=s.end(); it++)
        {
            sum+=(*it);
            if(sum>b)
            {
                break;
            }
            rez++;
        }
        if(max_rez<rez)
        {
            max_rez=rez;
            sol=x[i];
        }
    }
    return max_rez;
}

/*int main()
{
    int r, l;
    long long b;
    cin>>r>>l;
    int x[r];
    for(int i=0; i<r; i++)
        cin>>x[i];
    cin>>b;
    cout<<besthub(r, l, x, b);

    return 0;
}*/

Compilation message

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:5:27: warning: variable 'sol' set but not used [-Wunused-but-set-variable]
    5 |     long long max_rez=-1, sol=1;
      |                           ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 1 ms 344 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 10 ms 448 KB Output is correct
22 Correct 10 ms 348 KB Output is correct
23 Correct 11 ms 476 KB Output is correct
24 Correct 11 ms 476 KB Output is correct
25 Correct 12 ms 348 KB Output is correct
26 Correct 12 ms 472 KB Output is correct
27 Correct 11 ms 344 KB Output is correct
28 Correct 11 ms 472 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 460 KB Output is correct
3 Correct 36 ms 348 KB Output is correct
4 Correct 35 ms 348 KB Output is correct
5 Correct 10 ms 348 KB Output is correct
6 Correct 13 ms 348 KB Output is correct
7 Correct 40 ms 348 KB Output is correct
8 Correct 40 ms 344 KB Output is correct
9 Correct 11 ms 348 KB Output is correct
10 Correct 11 ms 348 KB Output is correct
11 Correct 32 ms 348 KB Output is correct
12 Correct 28 ms 348 KB Output is correct
13 Correct 54 ms 348 KB Output is correct
14 Correct 51 ms 344 KB Output is correct
15 Correct 11 ms 344 KB Output is correct
16 Correct 11 ms 468 KB Output is correct
17 Correct 32 ms 348 KB Output is correct
18 Correct 32 ms 344 KB Output is correct
19 Correct 55 ms 596 KB Output is correct
20 Correct 50 ms 348 KB Output is correct
21 Execution timed out 1024 ms 604 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1050 ms 1372 KB Time limit exceeded
2 Halted 0 ms 0 KB -