제출 #1176136

#제출 시각아이디문제언어결과실행 시간메모리
1176136chikien2009Stone Arranging 2 (JOI23_ho_t1)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>

using namespace std;

void setup()

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

int n, a[200000], b[200000];
deque<int> pos;
map<int, int> num;

int main()
{
    setup();

    cin >> n;
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
        while (num[a[i]] && !pos.empty() && a[pos.back()] != a[i])
        {
            num[a[pos.back()]]--;
            pos.pop_back();
        }
        b[i] = (pos.empty() ? -1 : pos.back());
        pos.push_back(i);
        num[a[i]]++;
    }
    for (int i = n - 1; i >= 0;)
    {
        for (int j = i; j > b[i];--j)
        {
            a[j] = a[i];
        }
        i = b[i];
    }
    for (int i = 0; i < n; ++i)
    {
        cout << a[i] << "\n";
    }
    return 0;
}

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

Main.cpp:7:5: error: expected initializer before 'ios_base'
    7 |     ios_base::sync_with_stdio(0);
      |     ^~~~~~~~
Main.cpp:8:5: error: 'cin' does not name a type
    8 |     cin.tie(0);
      |     ^~~
Main.cpp:9:5: error: 'cout' does not name a type
    9 |     cout.tie(0);
      |     ^~~~
Main.cpp:10:1: error: expected declaration before '}' token
   10 | }
      | ^
Main.cpp: In function 'int main()':
Main.cpp:18:5: error: 'setup' was not declared in this scope; did you mean 'setuid'?
   18 |     setup();
      |     ^~~~~
      |     setuid