제출 #985455

#제출 시각아이디문제언어결과실행 시간메모리
985455islam998Food Court (JOI21_foodcourt)C++17
2 / 100
1100 ms524288 KiB
#include <iostream>
#include <vector>
#include <deque>

using namespace std;

int main() {
    int N, M, Q;
    cin >> N >> M >> Q;
    
    vector<deque<int>> shops(N);  // Vector of deques to represent customers in each shop
    vector<int> results;          // Vector to store the results of "Service" events

    for (int i = 0; i < Q; ++i) {
        int T;
        cin >> T;
        
        if (T == 1) {  // Join event
            int L, R, C, K;
            cin >> L >> R >> C >> K;
            for (int j = L - 1; j < R; ++j) {
                for (int k = 0; k < K; ++k) {
                    shops[j].push_back(C);
                }
            }
        } else if (T == 2) {  // Leave event
            int L, R, K;
            cin >> L >> R >> K;
            for (int j = L - 1; j < R; ++j) {
                for (int k = 0; k < K && !shops[j].empty(); ++k) {
                    shops[j].pop_front();
                }
            }
        } else if (T == 3) {  // Service event
            int A, B;
            cin >> A >> B;
            if (B <= shops[A - 1].size()) {
                results.push_back(shops[A - 1][B - 1]);
            } else {
                results.push_back(0);
            }
        }
    }
    
    // Print all results of "Service" events
    for (int result : results) {
        cout << result << endl;
    }

    return 0;
}

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

foodcourt.cpp: In function 'int main()':
foodcourt.cpp:37:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::deque<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |             if (B <= shops[A - 1].size()) {
      |                 ~~^~~~~~~~~~~~~~~~~~~~~~
#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...