Submission #431006

# Submission time Handle Problem Language Result Execution time Memory
431006 2021-06-17T08:51:17 Z Hideo Food Court (JOI21_foodcourt) C++17
7 / 100
1000 ms 433752 KB
#include <bits/stdc++.h>
using namespace std;

#define all(s) s.begin(), s.end()
#define ll long long
#define fr first
#define sc second
#define pb push_back
#define mk make_pair
#define pi pair < int, int >

const int N = 65007;
const int INF = 1e9 + 7;

int n, m, q;

deque < pi > dq[N];

main (){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> m >> q;
    for (int i = 1; i <= q; i++){
        int t;
        cin >> t;
        if (t == 1){
            int l, r, c, k;
            cin >> l >> r >> c >> k;
            for (int j = l; j <= r; j++){
                dq[j].pb({k, c});
            }
        }
        else if (t == 2){
            int l, r, k;
            cin >> l >> r >> k;
            for (int j = l; j <= r; j++){
                int kc = k;
                while (!dq[j].empty() && kc){
                    int a = dq[j].front().fr, b = dq[j].front().sc;
                    dq[j].pop_front();
                    if (a > kc){
                        dq[j].push_front({a - kc, b});
                        break;
                    }
                    kc -= a;
                }
            }
        }
        else {
            int a, out = 0;
            ll b;
            cin >> a >> b;
            for (pi it : dq[a]){
                if (b <= it.fr){
                    out = it.sc;
                    break;
                }
                b -= it.fr;
            }
            cout << out << endl;
        }
    }
}

Compilation message

foodcourt.cpp:19:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   19 | main (){
      | ^~~~
# Verdict Execution time Memory Grader output
1 Correct 36 ms 44244 KB Output is correct
2 Correct 42 ms 44544 KB Output is correct
3 Correct 55 ms 47656 KB Output is correct
4 Correct 55 ms 49492 KB Output is correct
5 Correct 33 ms 43996 KB Output is correct
6 Correct 32 ms 43968 KB Output is correct
7 Correct 53 ms 49920 KB Output is correct
8 Correct 52 ms 48044 KB Output is correct
9 Correct 49 ms 44476 KB Output is correct
10 Correct 53 ms 47856 KB Output is correct
11 Correct 47 ms 46404 KB Output is correct
12 Correct 62 ms 44472 KB Output is correct
13 Correct 49 ms 44996 KB Output is correct
14 Correct 53 ms 45116 KB Output is correct
15 Correct 46 ms 46028 KB Output is correct
16 Correct 50 ms 44976 KB Output is correct
17 Correct 41 ms 44216 KB Output is correct
18 Correct 44 ms 44528 KB Output is correct
19 Correct 34 ms 44056 KB Output is correct
20 Correct 33 ms 44056 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 36 ms 44244 KB Output is correct
2 Correct 42 ms 44544 KB Output is correct
3 Correct 55 ms 47656 KB Output is correct
4 Correct 55 ms 49492 KB Output is correct
5 Correct 33 ms 43996 KB Output is correct
6 Correct 32 ms 43968 KB Output is correct
7 Correct 53 ms 49920 KB Output is correct
8 Correct 52 ms 48044 KB Output is correct
9 Correct 49 ms 44476 KB Output is correct
10 Correct 53 ms 47856 KB Output is correct
11 Correct 47 ms 46404 KB Output is correct
12 Correct 62 ms 44472 KB Output is correct
13 Correct 49 ms 44996 KB Output is correct
14 Correct 53 ms 45116 KB Output is correct
15 Correct 46 ms 46028 KB Output is correct
16 Correct 50 ms 44976 KB Output is correct
17 Correct 41 ms 44216 KB Output is correct
18 Correct 44 ms 44528 KB Output is correct
19 Correct 34 ms 44056 KB Output is correct
20 Correct 33 ms 44056 KB Output is correct
21 Correct 45 ms 44572 KB Output is correct
22 Correct 48 ms 44608 KB Output is correct
23 Correct 48 ms 47712 KB Output is correct
24 Correct 54 ms 49564 KB Output is correct
25 Correct 33 ms 44088 KB Output is correct
26 Correct 37 ms 44020 KB Output is correct
27 Correct 57 ms 49624 KB Output is correct
28 Correct 57 ms 48488 KB Output is correct
29 Correct 49 ms 45260 KB Output is correct
30 Correct 58 ms 47780 KB Output is correct
31 Correct 52 ms 46404 KB Output is correct
32 Correct 48 ms 44548 KB Output is correct
33 Correct 53 ms 44952 KB Output is correct
34 Correct 77 ms 46132 KB Output is correct
35 Correct 54 ms 44852 KB Output is correct
36 Correct 58 ms 45112 KB Output is correct
37 Correct 33 ms 43980 KB Output is correct
38 Correct 34 ms 44108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1093 ms 44204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 71 ms 89120 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 36 ms 44244 KB Output is correct
2 Correct 42 ms 44544 KB Output is correct
3 Correct 55 ms 47656 KB Output is correct
4 Correct 55 ms 49492 KB Output is correct
5 Correct 33 ms 43996 KB Output is correct
6 Correct 32 ms 43968 KB Output is correct
7 Correct 53 ms 49920 KB Output is correct
8 Correct 52 ms 48044 KB Output is correct
9 Correct 49 ms 44476 KB Output is correct
10 Correct 53 ms 47856 KB Output is correct
11 Correct 47 ms 46404 KB Output is correct
12 Correct 62 ms 44472 KB Output is correct
13 Correct 49 ms 44996 KB Output is correct
14 Correct 53 ms 45116 KB Output is correct
15 Correct 46 ms 46028 KB Output is correct
16 Correct 50 ms 44976 KB Output is correct
17 Correct 41 ms 44216 KB Output is correct
18 Correct 44 ms 44528 KB Output is correct
19 Correct 34 ms 44056 KB Output is correct
20 Correct 33 ms 44056 KB Output is correct
21 Execution timed out 1093 ms 44204 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1103 ms 433752 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 36 ms 44244 KB Output is correct
2 Correct 42 ms 44544 KB Output is correct
3 Correct 55 ms 47656 KB Output is correct
4 Correct 55 ms 49492 KB Output is correct
5 Correct 33 ms 43996 KB Output is correct
6 Correct 32 ms 43968 KB Output is correct
7 Correct 53 ms 49920 KB Output is correct
8 Correct 52 ms 48044 KB Output is correct
9 Correct 49 ms 44476 KB Output is correct
10 Correct 53 ms 47856 KB Output is correct
11 Correct 47 ms 46404 KB Output is correct
12 Correct 62 ms 44472 KB Output is correct
13 Correct 49 ms 44996 KB Output is correct
14 Correct 53 ms 45116 KB Output is correct
15 Correct 46 ms 46028 KB Output is correct
16 Correct 50 ms 44976 KB Output is correct
17 Correct 41 ms 44216 KB Output is correct
18 Correct 44 ms 44528 KB Output is correct
19 Correct 34 ms 44056 KB Output is correct
20 Correct 33 ms 44056 KB Output is correct
21 Correct 45 ms 44572 KB Output is correct
22 Correct 48 ms 44608 KB Output is correct
23 Correct 48 ms 47712 KB Output is correct
24 Correct 54 ms 49564 KB Output is correct
25 Correct 33 ms 44088 KB Output is correct
26 Correct 37 ms 44020 KB Output is correct
27 Correct 57 ms 49624 KB Output is correct
28 Correct 57 ms 48488 KB Output is correct
29 Correct 49 ms 45260 KB Output is correct
30 Correct 58 ms 47780 KB Output is correct
31 Correct 52 ms 46404 KB Output is correct
32 Correct 48 ms 44548 KB Output is correct
33 Correct 53 ms 44952 KB Output is correct
34 Correct 77 ms 46132 KB Output is correct
35 Correct 54 ms 44852 KB Output is correct
36 Correct 58 ms 45112 KB Output is correct
37 Correct 33 ms 43980 KB Output is correct
38 Correct 34 ms 44108 KB Output is correct
39 Execution timed out 1093 ms 44204 KB Time limit exceeded
40 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 36 ms 44244 KB Output is correct
2 Correct 42 ms 44544 KB Output is correct
3 Correct 55 ms 47656 KB Output is correct
4 Correct 55 ms 49492 KB Output is correct
5 Correct 33 ms 43996 KB Output is correct
6 Correct 32 ms 43968 KB Output is correct
7 Correct 53 ms 49920 KB Output is correct
8 Correct 52 ms 48044 KB Output is correct
9 Correct 49 ms 44476 KB Output is correct
10 Correct 53 ms 47856 KB Output is correct
11 Correct 47 ms 46404 KB Output is correct
12 Correct 62 ms 44472 KB Output is correct
13 Correct 49 ms 44996 KB Output is correct
14 Correct 53 ms 45116 KB Output is correct
15 Correct 46 ms 46028 KB Output is correct
16 Correct 50 ms 44976 KB Output is correct
17 Correct 41 ms 44216 KB Output is correct
18 Correct 44 ms 44528 KB Output is correct
19 Correct 34 ms 44056 KB Output is correct
20 Correct 33 ms 44056 KB Output is correct
21 Correct 45 ms 44572 KB Output is correct
22 Correct 48 ms 44608 KB Output is correct
23 Correct 48 ms 47712 KB Output is correct
24 Correct 54 ms 49564 KB Output is correct
25 Correct 33 ms 44088 KB Output is correct
26 Correct 37 ms 44020 KB Output is correct
27 Correct 57 ms 49624 KB Output is correct
28 Correct 57 ms 48488 KB Output is correct
29 Correct 49 ms 45260 KB Output is correct
30 Correct 58 ms 47780 KB Output is correct
31 Correct 52 ms 46404 KB Output is correct
32 Correct 48 ms 44548 KB Output is correct
33 Correct 53 ms 44952 KB Output is correct
34 Correct 77 ms 46132 KB Output is correct
35 Correct 54 ms 44852 KB Output is correct
36 Correct 58 ms 45112 KB Output is correct
37 Correct 33 ms 43980 KB Output is correct
38 Correct 34 ms 44108 KB Output is correct
39 Execution timed out 1093 ms 44204 KB Time limit exceeded
40 Halted 0 ms 0 KB -