제출 #431006

#제출 시각아이디문제언어결과실행 시간메모리
431006Hideo푸드 코트 (JOI21_foodcourt)C++17
7 / 100
1103 ms433752 KiB
#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;
        }
    }
}

컴파일 시 표준 에러 (stderr) 메시지

foodcourt.cpp:19:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   19 | main (){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...