답안 #961099

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
961099 2024-04-11T13:48:41 Z The_Cryptic_TG A Plus B (IOI23_aplusb) C++17
컴파일 오류
0 ms 0 KB
#include "aplusb.h"
#include <iostream>
#include <vector>
#include <bits/stdc++.h>
#include <set>
#define ll long long
 
std::vector<ll> smallest_sums(ll n, std::vector<ll> a, std::vector<ll> b)
    {
        std::multiset<ll> s;
        loop1(i, n)
        {
            loop(j, n / i)
            {
                s.insert(a[i - 1] + b[j]);
            }
        }
        auto it = s.begin();
        ll k = n;
        vector <ll> ans;
        while (k--)
        {
            ans.push_back(*it);
            it++;
        }
        return ans;
    }

Compilation message

aplusb.cpp: In function 'std::vector<long long int> smallest_sums(long long int, std::vector<long long int>, std::vector<long long int>)':
aplusb.cpp:11:15: error: 'i' was not declared in this scope
   11 |         loop1(i, n)
      |               ^
aplusb.cpp:11:9: error: 'loop1' was not declared in this scope
   11 |         loop1(i, n)
      |         ^~~~~
aplusb.cpp:20:9: error: 'vector' was not declared in this scope
   20 |         vector <ll> ans;
      |         ^~~~~~
aplusb.cpp:20:9: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from aplusb.h:1,
                 from aplusb.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from aplusb.h:1,
                 from aplusb.cpp:1:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
aplusb.cpp:6:12: error: expected primary-expression before 'long'
    6 | #define ll long long
      |            ^~~~
aplusb.cpp:20:17: note: in expansion of macro 'll'
   20 |         vector <ll> ans;
      |                 ^~
aplusb.cpp:23:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   23 |             ans.push_back(*it);
      |             ^~~
      |             abs
aplusb.cpp:26:16: error: 'ans' was not declared in this scope; did you mean 'abs'?
   26 |         return ans;
      |                ^~~
      |                abs