답안 #493217

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
493217 2021-12-10T12:27:55 Z blue Toys (CEOI18_toy) C++17
컴파일 오류
0 ms 0 KB
#include <iostream>
#include <vector>
#include <set>
using namespace std;

#define sz(x) (int(x.size()))

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    cin >> n;

    vector<int> res[1+n];
    for(int i = 1; i <= n; i++)
    {
        res[i].push_back(i-1);
        for(int j = 1; j < i; j++)
        {
            if(i % j == 0)
            {
                int u = j;
                int v = i/j;
                for(int a: res[u])
                    for(int b: res[v])
                        res[i].push_back(a+b);
                // break;
            }
        }
        sort(res[i].begin(), res[i].end());
        res[i].erase(unique(res[i].begin(), res[i].end()), res[i].end());
    }

    cout << sz(res[n]) << '\n';
    for(int r: res[n]) cout << r << ' ';
    cout << '\n';
}

Compilation message

toy.cpp: In function 'int main()':
toy.cpp:32:9: error: 'sort' was not declared in this scope; did you mean 'qsort'?
   32 |         sort(res[i].begin(), res[i].end());
      |         ^~~~
      |         qsort
toy.cpp:33:22: error: 'unique' was not declared in this scope
   33 |         res[i].erase(unique(res[i].begin(), res[i].end()), res[i].end());
      |                      ^~~~~~