답안 #797173

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
797173 2023-07-29T07:40:13 Z vjudge1 푸드 코트 (JOI21_foodcourt) C++17
2 / 100
8 ms 4436 KB
#include<bits/stdc++.h>

using namespace std;
using ll = long long;

const int N = 2010;
int n, m, q;

deque<int> g[N]; 



int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin >> n >> m >> q;
    if(n <= 2000 && q <= 2000) {
        for(int i = 0; i < q; i++) {
            int t;
            cin >> t;
            if(t == 1) {
                ll l, r, c, k;
                cin >> l >> r >> c >> k;
                for(int j = l; j <= r; j++) {
                    g[j].push_back(c);
                }
            }
            if(t == 2) {
                ll l, r, k;
                cin >> l >> r >> k;
                for(int j = l; j <= r; j++) {
                    if(!g[j].empty()) g[j].pop_front();
                    // while(!g[j].empty() && g[j].front().second <= k) {
                    //     k -= g[j].front().second;
                    //     g[j].pop_front();
                    // }
                    // if(!g[j].empty()) 
                    //     g[j][0].second -= k;
                }
            }
            if(t == 3) {
                ll a, b;
                cin >> a >> b;
                int ans = 0;
                // for(auto [c, k] : g[a]) {
                //     if(b > k) b -= k;
                //     else {ans = c; break;}
                // }
                if(g[a].size() >= b) ans = g[a][b - 1];
                cout << ans << '\n';    
                  
            }
        }
        return 0;
    }
}

Compilation message

foodcourt.cpp: In function 'int main()':
foodcourt.cpp:49:32: warning: comparison of integer expressions of different signedness: 'std::deque<int>::size_type' {aka 'long unsigned int'} and 'll' {aka 'long long int'} [-Wsign-compare]
   49 |                 if(g[a].size() >= b) ans = g[a][b - 1];
      |                    ~~~~~~~~~~~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1800 KB Output is correct
2 Correct 3 ms 2004 KB Output is correct
3 Correct 3 ms 3284 KB Output is correct
4 Correct 5 ms 4436 KB Output is correct
5 Correct 1 ms 1676 KB Output is correct
6 Correct 2 ms 1620 KB Output is correct
7 Correct 8 ms 4236 KB Output is correct
8 Correct 5 ms 3668 KB Output is correct
9 Correct 4 ms 2108 KB Output is correct
10 Correct 5 ms 3596 KB Output is correct
11 Correct 6 ms 2900 KB Output is correct
12 Correct 4 ms 2004 KB Output is correct
13 Correct 5 ms 2608 KB Output is correct
14 Correct 7 ms 2708 KB Output is correct
15 Correct 5 ms 2644 KB Output is correct
16 Correct 6 ms 2696 KB Output is correct
17 Correct 3 ms 1748 KB Output is correct
18 Correct 4 ms 1748 KB Output is correct
19 Correct 2 ms 1620 KB Output is correct
20 Correct 1 ms 1620 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1800 KB Output is correct
2 Correct 3 ms 2004 KB Output is correct
3 Correct 3 ms 3284 KB Output is correct
4 Correct 5 ms 4436 KB Output is correct
5 Correct 1 ms 1676 KB Output is correct
6 Correct 2 ms 1620 KB Output is correct
7 Correct 8 ms 4236 KB Output is correct
8 Correct 5 ms 3668 KB Output is correct
9 Correct 4 ms 2108 KB Output is correct
10 Correct 5 ms 3596 KB Output is correct
11 Correct 6 ms 2900 KB Output is correct
12 Correct 4 ms 2004 KB Output is correct
13 Correct 5 ms 2608 KB Output is correct
14 Correct 7 ms 2708 KB Output is correct
15 Correct 5 ms 2644 KB Output is correct
16 Correct 6 ms 2696 KB Output is correct
17 Correct 3 ms 1748 KB Output is correct
18 Correct 4 ms 1748 KB Output is correct
19 Correct 2 ms 1620 KB Output is correct
20 Correct 1 ms 1620 KB Output is correct
21 Incorrect 3 ms 1876 KB Output isn't correct
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 1620 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 1620 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1800 KB Output is correct
2 Correct 3 ms 2004 KB Output is correct
3 Correct 3 ms 3284 KB Output is correct
4 Correct 5 ms 4436 KB Output is correct
5 Correct 1 ms 1676 KB Output is correct
6 Correct 2 ms 1620 KB Output is correct
7 Correct 8 ms 4236 KB Output is correct
8 Correct 5 ms 3668 KB Output is correct
9 Correct 4 ms 2108 KB Output is correct
10 Correct 5 ms 3596 KB Output is correct
11 Correct 6 ms 2900 KB Output is correct
12 Correct 4 ms 2004 KB Output is correct
13 Correct 5 ms 2608 KB Output is correct
14 Correct 7 ms 2708 KB Output is correct
15 Correct 5 ms 2644 KB Output is correct
16 Correct 6 ms 2696 KB Output is correct
17 Correct 3 ms 1748 KB Output is correct
18 Correct 4 ms 1748 KB Output is correct
19 Correct 2 ms 1620 KB Output is correct
20 Correct 1 ms 1620 KB Output is correct
21 Incorrect 1 ms 1620 KB Output isn't correct
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 1620 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1800 KB Output is correct
2 Correct 3 ms 2004 KB Output is correct
3 Correct 3 ms 3284 KB Output is correct
4 Correct 5 ms 4436 KB Output is correct
5 Correct 1 ms 1676 KB Output is correct
6 Correct 2 ms 1620 KB Output is correct
7 Correct 8 ms 4236 KB Output is correct
8 Correct 5 ms 3668 KB Output is correct
9 Correct 4 ms 2108 KB Output is correct
10 Correct 5 ms 3596 KB Output is correct
11 Correct 6 ms 2900 KB Output is correct
12 Correct 4 ms 2004 KB Output is correct
13 Correct 5 ms 2608 KB Output is correct
14 Correct 7 ms 2708 KB Output is correct
15 Correct 5 ms 2644 KB Output is correct
16 Correct 6 ms 2696 KB Output is correct
17 Correct 3 ms 1748 KB Output is correct
18 Correct 4 ms 1748 KB Output is correct
19 Correct 2 ms 1620 KB Output is correct
20 Correct 1 ms 1620 KB Output is correct
21 Incorrect 3 ms 1876 KB Output isn't correct
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1800 KB Output is correct
2 Correct 3 ms 2004 KB Output is correct
3 Correct 3 ms 3284 KB Output is correct
4 Correct 5 ms 4436 KB Output is correct
5 Correct 1 ms 1676 KB Output is correct
6 Correct 2 ms 1620 KB Output is correct
7 Correct 8 ms 4236 KB Output is correct
8 Correct 5 ms 3668 KB Output is correct
9 Correct 4 ms 2108 KB Output is correct
10 Correct 5 ms 3596 KB Output is correct
11 Correct 6 ms 2900 KB Output is correct
12 Correct 4 ms 2004 KB Output is correct
13 Correct 5 ms 2608 KB Output is correct
14 Correct 7 ms 2708 KB Output is correct
15 Correct 5 ms 2644 KB Output is correct
16 Correct 6 ms 2696 KB Output is correct
17 Correct 3 ms 1748 KB Output is correct
18 Correct 4 ms 1748 KB Output is correct
19 Correct 2 ms 1620 KB Output is correct
20 Correct 1 ms 1620 KB Output is correct
21 Incorrect 3 ms 1876 KB Output isn't correct
22 Halted 0 ms 0 KB -