Submission #463379

# Submission time Handle Problem Language Result Execution time Memory
463379 2021-08-11T04:40:26 Z Eshperov Fountain (eJOI20_fountain) C++17
30 / 100
1500 ms 1216 KB
#include <bits/stdc++.h>

using namespace std;

struct fountain
{
    int diameter, capacity;
};
int main()
{
    int n, q, id, water_volume;
    
    cin >> n >> q;
    
    vector <fountain> v(n+1);
    
    for(int i = 1; i <= n; i++)
    {
        cin >> v[i].diameter >> v[i].capacity;
    }
    while(q--)
    {
        int mx = 0;
        
        cin >> id >> water_volume;
        
        for(int i = id; water_volume > 0 && i <= n; i++)
        {
            if(v[i].diameter > mx)
            {
                mx = v[i].diameter;
                
                water_volume -= v[i].capacity;
            }
            
            if(water_volume <= 0)
                cout << i << "\n";
        }
        if(water_volume > 0)
            cout << "0\n";
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 3 ms 204 KB Output is correct
3 Correct 3 ms 204 KB Output is correct
4 Correct 4 ms 204 KB Output is correct
5 Correct 8 ms 204 KB Output is correct
6 Correct 6 ms 204 KB Output is correct
7 Correct 5 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1561 ms 1216 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 3 ms 204 KB Output is correct
3 Correct 3 ms 204 KB Output is correct
4 Correct 4 ms 204 KB Output is correct
5 Correct 8 ms 204 KB Output is correct
6 Correct 6 ms 204 KB Output is correct
7 Correct 5 ms 204 KB Output is correct
8 Execution timed out 1561 ms 1216 KB Time limit exceeded
9 Halted 0 ms 0 KB -