Submission #463426

# Submission time Handle Problem Language Result Execution time Memory
463426 2021-08-11T06:34:37 Z gavgav Fountain (eJOI20_fountain) C++17
Compilation error
0 ms 0 KB
#include <iostream>
#include <stack>
using namespace std;
int main(){
    uint32_t N, Q, level, volume;
    cin >> N >> Q;
    uint32_t diametrs[N], ng[N] {};
    uint16_t capacitys[N], 
    stack <uint32_t> meowmeow;
    for (uint32_t i = 0; i < N; i++){
        cin >> diametrs[i] >> capacitys[i];
        while (!meowmeow.empty() && diametrs[meowmeow.top()] < diametrs[i]){
                ng[meowmeow.top()] = i;
                meowmeow.pop();
        }
        meowmeow.push(i);
    }
    for (uint32_t i = 0; i < Q; i++){
        cin >> level >> volume;
        level--;
        do{
            if (volume < capacitys[level] + 1){
                level++;
                break;
            }
            volume -= capacitys[level];
            level = ng[level];
        } while (level);
        cout << level << endl;
    }
}

Compilation message

fountain.cpp: In function 'int main()':
fountain.cpp:9:22: error: invalid declarator before 'meowmeow'
    9 |     stack <uint32_t> meowmeow;
      |                      ^~~~~~~~
fountain.cpp:12:17: error: 'meowmeow' was not declared in this scope
   12 |         while (!meowmeow.empty() && diametrs[meowmeow.top()] < diametrs[i]){
      |                 ^~~~~~~~
fountain.cpp:16:9: error: 'meowmeow' was not declared in this scope
   16 |         meowmeow.push(i);
      |         ^~~~~~~~
fountain.cpp:22:24: warning: comparison of integer expressions of different signedness: 'uint32_t' {aka 'unsigned int'} and 'int' [-Wsign-compare]
   22 |             if (volume < capacitys[level] + 1){
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~