Submission #540100

# Submission time Handle Problem Language Result Execution time Memory
540100 2022-03-19T08:59:53 Z LittleCube Food Court (JOI21_foodcourt) C++17
7 / 100
30 ms 14164 KB
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define F first
#define S second
using namespace std;

int N, M, Q;
deque<pll> v[2005];

signed main()
{
    ios::sync_with_stdio(0), cin.tie(0);
    cin >> N >> M >> Q;
    for (int i = 1; i <= Q; i++)
    {
        ll T, L, R, C, K;
        cin >> T >> L >> R;
        if (T == 1)
        {
            cin >> C >> K;
            for (int j = L; j <= R; j++)
                v[j].emplace_back(pll{K, C});
        }
        else if (T == 2)
        {
            cin >> K;
            for (int j = L; j <= R; j++)
            {
                ll rem = K;
                while (!v[j].empty() && rem > 0)
                {
                    if (v[j].front().F > rem)
                    {
                        v[j].front().F -= rem;
                        rem = 0;
                    }
                    else if (v[j].front().F <= rem)
                    {
                        rem -= v[j].front().F;
                        v[j].pop_front();
                    }
                }
            }
        }
        else if(T == 3)
        {
            ll rem = R, ans = 0;
            for(auto [cnt, c] : v[L])
            {
                if(rem <= cnt)
                {
                    ans = c;
                    break;
                }
                else
                    rem -= cnt;
            }
            cout << ans << '\n';
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 6 ms 2004 KB Output is correct
2 Correct 10 ms 2432 KB Output is correct
3 Correct 16 ms 9068 KB Output is correct
4 Correct 28 ms 12612 KB Output is correct
5 Correct 2 ms 1620 KB Output is correct
6 Correct 2 ms 1620 KB Output is correct
7 Correct 25 ms 14164 KB Output is correct
8 Correct 21 ms 9768 KB Output is correct
9 Correct 12 ms 2480 KB Output is correct
10 Correct 23 ms 9244 KB Output is correct
11 Correct 15 ms 6356 KB Output is correct
12 Correct 9 ms 2516 KB Output is correct
13 Correct 17 ms 2612 KB Output is correct
14 Correct 15 ms 3724 KB Output is correct
15 Correct 12 ms 4564 KB Output is correct
16 Correct 14 ms 3668 KB Output is correct
17 Correct 12 ms 2004 KB Output is correct
18 Correct 11 ms 2132 KB Output is correct
19 Correct 2 ms 1620 KB Output is correct
20 Correct 2 ms 1620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 2004 KB Output is correct
2 Correct 10 ms 2432 KB Output is correct
3 Correct 16 ms 9068 KB Output is correct
4 Correct 28 ms 12612 KB Output is correct
5 Correct 2 ms 1620 KB Output is correct
6 Correct 2 ms 1620 KB Output is correct
7 Correct 25 ms 14164 KB Output is correct
8 Correct 21 ms 9768 KB Output is correct
9 Correct 12 ms 2480 KB Output is correct
10 Correct 23 ms 9244 KB Output is correct
11 Correct 15 ms 6356 KB Output is correct
12 Correct 9 ms 2516 KB Output is correct
13 Correct 17 ms 2612 KB Output is correct
14 Correct 15 ms 3724 KB Output is correct
15 Correct 12 ms 4564 KB Output is correct
16 Correct 14 ms 3668 KB Output is correct
17 Correct 12 ms 2004 KB Output is correct
18 Correct 11 ms 2132 KB Output is correct
19 Correct 2 ms 1620 KB Output is correct
20 Correct 2 ms 1620 KB Output is correct
21 Correct 7 ms 2388 KB Output is correct
22 Correct 10 ms 2552 KB Output is correct
23 Correct 14 ms 8952 KB Output is correct
24 Correct 27 ms 12688 KB Output is correct
25 Correct 2 ms 1700 KB Output is correct
26 Correct 2 ms 1620 KB Output is correct
27 Correct 19 ms 13652 KB Output is correct
28 Correct 20 ms 10580 KB Output is correct
29 Correct 14 ms 4312 KB Output is correct
30 Correct 20 ms 8808 KB Output is correct
31 Correct 21 ms 6292 KB Output is correct
32 Correct 12 ms 2388 KB Output is correct
33 Correct 18 ms 2560 KB Output is correct
34 Correct 23 ms 4792 KB Output is correct
35 Correct 24 ms 3284 KB Output is correct
36 Correct 30 ms 3760 KB Output is correct
37 Correct 3 ms 1620 KB Output is correct
38 Correct 4 ms 1732 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 3156 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 3148 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 2004 KB Output is correct
2 Correct 10 ms 2432 KB Output is correct
3 Correct 16 ms 9068 KB Output is correct
4 Correct 28 ms 12612 KB Output is correct
5 Correct 2 ms 1620 KB Output is correct
6 Correct 2 ms 1620 KB Output is correct
7 Correct 25 ms 14164 KB Output is correct
8 Correct 21 ms 9768 KB Output is correct
9 Correct 12 ms 2480 KB Output is correct
10 Correct 23 ms 9244 KB Output is correct
11 Correct 15 ms 6356 KB Output is correct
12 Correct 9 ms 2516 KB Output is correct
13 Correct 17 ms 2612 KB Output is correct
14 Correct 15 ms 3724 KB Output is correct
15 Correct 12 ms 4564 KB Output is correct
16 Correct 14 ms 3668 KB Output is correct
17 Correct 12 ms 2004 KB Output is correct
18 Correct 11 ms 2132 KB Output is correct
19 Correct 2 ms 1620 KB Output is correct
20 Correct 2 ms 1620 KB Output is correct
21 Runtime error 3 ms 3156 KB Execution killed with signal 11
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 3156 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 2004 KB Output is correct
2 Correct 10 ms 2432 KB Output is correct
3 Correct 16 ms 9068 KB Output is correct
4 Correct 28 ms 12612 KB Output is correct
5 Correct 2 ms 1620 KB Output is correct
6 Correct 2 ms 1620 KB Output is correct
7 Correct 25 ms 14164 KB Output is correct
8 Correct 21 ms 9768 KB Output is correct
9 Correct 12 ms 2480 KB Output is correct
10 Correct 23 ms 9244 KB Output is correct
11 Correct 15 ms 6356 KB Output is correct
12 Correct 9 ms 2516 KB Output is correct
13 Correct 17 ms 2612 KB Output is correct
14 Correct 15 ms 3724 KB Output is correct
15 Correct 12 ms 4564 KB Output is correct
16 Correct 14 ms 3668 KB Output is correct
17 Correct 12 ms 2004 KB Output is correct
18 Correct 11 ms 2132 KB Output is correct
19 Correct 2 ms 1620 KB Output is correct
20 Correct 2 ms 1620 KB Output is correct
21 Correct 7 ms 2388 KB Output is correct
22 Correct 10 ms 2552 KB Output is correct
23 Correct 14 ms 8952 KB Output is correct
24 Correct 27 ms 12688 KB Output is correct
25 Correct 2 ms 1700 KB Output is correct
26 Correct 2 ms 1620 KB Output is correct
27 Correct 19 ms 13652 KB Output is correct
28 Correct 20 ms 10580 KB Output is correct
29 Correct 14 ms 4312 KB Output is correct
30 Correct 20 ms 8808 KB Output is correct
31 Correct 21 ms 6292 KB Output is correct
32 Correct 12 ms 2388 KB Output is correct
33 Correct 18 ms 2560 KB Output is correct
34 Correct 23 ms 4792 KB Output is correct
35 Correct 24 ms 3284 KB Output is correct
36 Correct 30 ms 3760 KB Output is correct
37 Correct 3 ms 1620 KB Output is correct
38 Correct 4 ms 1732 KB Output is correct
39 Runtime error 3 ms 3156 KB Execution killed with signal 11
40 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 2004 KB Output is correct
2 Correct 10 ms 2432 KB Output is correct
3 Correct 16 ms 9068 KB Output is correct
4 Correct 28 ms 12612 KB Output is correct
5 Correct 2 ms 1620 KB Output is correct
6 Correct 2 ms 1620 KB Output is correct
7 Correct 25 ms 14164 KB Output is correct
8 Correct 21 ms 9768 KB Output is correct
9 Correct 12 ms 2480 KB Output is correct
10 Correct 23 ms 9244 KB Output is correct
11 Correct 15 ms 6356 KB Output is correct
12 Correct 9 ms 2516 KB Output is correct
13 Correct 17 ms 2612 KB Output is correct
14 Correct 15 ms 3724 KB Output is correct
15 Correct 12 ms 4564 KB Output is correct
16 Correct 14 ms 3668 KB Output is correct
17 Correct 12 ms 2004 KB Output is correct
18 Correct 11 ms 2132 KB Output is correct
19 Correct 2 ms 1620 KB Output is correct
20 Correct 2 ms 1620 KB Output is correct
21 Correct 7 ms 2388 KB Output is correct
22 Correct 10 ms 2552 KB Output is correct
23 Correct 14 ms 8952 KB Output is correct
24 Correct 27 ms 12688 KB Output is correct
25 Correct 2 ms 1700 KB Output is correct
26 Correct 2 ms 1620 KB Output is correct
27 Correct 19 ms 13652 KB Output is correct
28 Correct 20 ms 10580 KB Output is correct
29 Correct 14 ms 4312 KB Output is correct
30 Correct 20 ms 8808 KB Output is correct
31 Correct 21 ms 6292 KB Output is correct
32 Correct 12 ms 2388 KB Output is correct
33 Correct 18 ms 2560 KB Output is correct
34 Correct 23 ms 4792 KB Output is correct
35 Correct 24 ms 3284 KB Output is correct
36 Correct 30 ms 3760 KB Output is correct
37 Correct 3 ms 1620 KB Output is correct
38 Correct 4 ms 1732 KB Output is correct
39 Runtime error 3 ms 3156 KB Execution killed with signal 11
40 Halted 0 ms 0 KB -