답안 #784652

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
784652 2023-07-16T11:33:38 Z boris_mihov Abracadabra (CEOI22_abracadabra) C++17
컴파일 오류
0 ms 0 KB
#include <algorithm>
#include <iostream>
#include <numeric>
#include <cassert>
#include <cstring>
#include <vector>
#include <stack>
 
typedef long long llong;
const int MAXN = 200000 + 10;
const int MAXQ = 1000000 + 10;
const llong INF = 1e18;
const int INTINF = 1e9;
 
int n, q;
int a[MAXN];
int b[MAXN];
int output[MAXQ];
std::vector <std::pair <int,int>> v[MAXN];
 
void riffle()
{
    std::merge(a + 1, a + n/2 + 1, a + n/2 + 1, a + n + 1, b + 1);
    for (int i = 1 ; i <= n ; ++i)
    {
        a[i] = b[i];
    }
}
 
void solve()
{
    for (int i = 0 ; i <= n ; ++i)
    {
        for (const auto &[pos, idx] : v[i])
        {
            output[idx] = a[pos];
        }
 
        riffle();
    }
}
 
void print()
{
    for (int i = 1 ; i <= q ; ++i)
    {
        std::cout << output[i] << '\n';
    }
}
 
void input()
{
    std::cin >> n >> q;
    for (int i = 1 ; i <= n ; ++i)
    {
        std::cin >> a[i];
    }
 
    for (int i = 1 ; i <= q ; ++i)
    {
        int t, idx;
        std::cin >> t >> idx;
        v[std::min(t, sqrt(n))].push_back({idx, i});
    }
}
 
void fastIOI()
{
    std::ios_base :: sync_with_stdio(0);
    std::cout.tie(nullptr);
    std::cin.tie(nullptr);
}
 
int main()
{
    fastIOI();
    input();
    solve();
    print();
 
    return 0;
}

Compilation message

Main.cpp: In function 'void input()':
Main.cpp:63:23: error: 'sqrt' was not declared in this scope
   63 |         v[std::min(t, sqrt(n))].push_back({idx, i});
      |                       ^~~~