Submission #1067857

# Submission time Handle Problem Language Result Execution time Memory
1067857 2024-08-21T04:43:47 Z Muhammad_Aneeq Meetings (IOI18_meetings) C++17
19 / 100
1510 ms 786432 KB
#include <vector>
using namespace std;
vector<long long> minimum_costs(vector<int> H, vector<int> L,vector<int> R)
{
    int n=H.size();
    vector<long long>ans(L.size(),1e15);
    vector<int>qu[n]={};
    for (int i=0;i<L.size();i++)
    {
        for (int j=L[i];j<=R[i];j++)
            qu[j].push_back(i);
    }
    int val[n]={};
    long long pre[n+1]={};
    for (int i=0;i<n;i++)
    {
        if (qu[i].size()==0)
            continue;
        int mx=H[i];
        val[i]=mx;
        for (int j=i-1;j>=0;j--)
        {
            mx=max(mx,H[j]);
            val[j]=mx;
        }
        mx=H[i];
        for (int j=i+1;j<n;j++)
        {
            mx=max(mx,H[j]);
            val[j]=mx;
        }
        for (int j=1;j<=n;j++)
            pre[j]=pre[j-1]+val[j-1];
        for (auto j:qu[i])
            ans[j]=min(ans[j],pre[R[j]+1]-pre[L[j]]);
    }
    return ans;
}

Compilation message

meetings.cpp: In function 'std::vector<long long int> minimum_costs(std::vector<int>, std::vector<int>, std::vector<int>)':
meetings.cpp:8:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |     for (int i=0;i<L.size();i++)
      |                  ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 15 ms 680 KB Output is correct
3 Correct 16 ms 856 KB Output is correct
4 Correct 15 ms 600 KB Output is correct
5 Correct 13 ms 604 KB Output is correct
6 Correct 13 ms 640 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 6 ms 600 KB Output is correct
9 Correct 28 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 15 ms 680 KB Output is correct
3 Correct 16 ms 856 KB Output is correct
4 Correct 15 ms 600 KB Output is correct
5 Correct 13 ms 604 KB Output is correct
6 Correct 13 ms 640 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 6 ms 600 KB Output is correct
9 Correct 28 ms 600 KB Output is correct
10 Correct 107 ms 51536 KB Output is correct
11 Correct 240 ms 138324 KB Output is correct
12 Correct 102 ms 51072 KB Output is correct
13 Correct 252 ms 138324 KB Output is correct
14 Correct 115 ms 52000 KB Output is correct
15 Correct 116 ms 52008 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1510 ms 677144 KB Output is correct
3 Runtime error 1027 ms 786432 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1510 ms 677144 KB Output is correct
3 Runtime error 1027 ms 786432 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 15 ms 680 KB Output is correct
3 Correct 16 ms 856 KB Output is correct
4 Correct 15 ms 600 KB Output is correct
5 Correct 13 ms 604 KB Output is correct
6 Correct 13 ms 640 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 6 ms 600 KB Output is correct
9 Correct 28 ms 600 KB Output is correct
10 Correct 107 ms 51536 KB Output is correct
11 Correct 240 ms 138324 KB Output is correct
12 Correct 102 ms 51072 KB Output is correct
13 Correct 252 ms 138324 KB Output is correct
14 Correct 115 ms 52000 KB Output is correct
15 Correct 116 ms 52008 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1510 ms 677144 KB Output is correct
18 Runtime error 1027 ms 786432 KB Execution killed with signal 9
19 Halted 0 ms 0 KB -