답안 #503689

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
503689 2022-01-08T15:31:38 Z andrei_boaca Toys (CEOI18_toy) C++17
79 / 100
2512 ms 44388 KB
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
int n;
set<int> sol;
vector<int> v;
queue<vector<int>> coada;
map<vector<int>,int> vuse;
unordered_map<int,int> use;
int main()
{
    cin>>n;
    vector<int> a;
    a.push_back(n);
    coada.push(a);
    vuse[a]=1;
    while(!coada.empty())
    {
        v=coada.front();
        vuse[v]=1;
        coada.pop();
        int suma=0;
        for(int i:v)
            suma+=(i-1);
        sol.insert(suma);
        for(int i=0;i<v.size();i++)
        {
            for(int d=2;d*d<=v[i];d++)
                if(v[i]%d==0)
                {
                    int y=v[i]/d;
                    int x=d;
                    int s=suma-(v[i]-1)+(x-1)+(y-1);
                    if(use[s]<10)
                    {
                        sol.insert(s);
                        vector<int> aux;
                        for(int j=0;j<v.size();j++)
                            if(j!=i)
                                aux.push_back(v[j]);
                        aux.push_back(x);
                        aux.push_back(y);
                        sort(aux.begin(),aux.end());
                        if(!vuse[aux])
                        {
                            vuse[aux]=1;
                            use[s]++;
                            coada.push(aux);
                        }
                    }
                }
        }
    }
    cout<<sol.size()<<'\n';
    for(auto i:sol)
        cout<<i<<' ';
    return 0;
}

Compilation message

toy.cpp: In function 'int main()':
toy.cpp:26:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |         for(int i=0;i<v.size();i++)
      |                     ~^~~~~~~~~
toy.cpp:38:38: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |                         for(int j=0;j<v.size();j++)
      |                                     ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 292 KB Output is correct
3 Correct 0 ms 288 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 0 ms 204 KB Output is correct
23 Correct 0 ms 204 KB Output is correct
24 Correct 0 ms 292 KB Output is correct
25 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 292 KB Output is correct
3 Correct 0 ms 288 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 0 ms 204 KB Output is correct
23 Correct 0 ms 204 KB Output is correct
24 Correct 0 ms 292 KB Output is correct
25 Correct 0 ms 204 KB Output is correct
26 Correct 2 ms 288 KB Output is correct
27 Correct 1 ms 332 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 292 KB Output is correct
31 Correct 2 ms 332 KB Output is correct
32 Correct 2 ms 296 KB Output is correct
33 Correct 1 ms 296 KB Output is correct
34 Correct 0 ms 204 KB Output is correct
35 Correct 0 ms 204 KB Output is correct
36 Correct 1 ms 300 KB Output is correct
37 Correct 1 ms 332 KB Output is correct
38 Correct 1 ms 204 KB Output is correct
39 Correct 1 ms 280 KB Output is correct
40 Correct 1 ms 332 KB Output is correct
41 Correct 1 ms 204 KB Output is correct
42 Correct 0 ms 280 KB Output is correct
43 Correct 0 ms 204 KB Output is correct
44 Correct 1 ms 204 KB Output is correct
45 Correct 1 ms 292 KB Output is correct
46 Correct 0 ms 292 KB Output is correct
47 Correct 2 ms 332 KB Output is correct
48 Correct 0 ms 292 KB Output is correct
49 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 292 KB Output is correct
3 Correct 0 ms 288 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 0 ms 204 KB Output is correct
23 Correct 0 ms 204 KB Output is correct
24 Correct 0 ms 292 KB Output is correct
25 Correct 0 ms 204 KB Output is correct
26 Correct 2 ms 288 KB Output is correct
27 Correct 1 ms 332 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 292 KB Output is correct
31 Correct 2 ms 332 KB Output is correct
32 Correct 2 ms 296 KB Output is correct
33 Correct 1 ms 296 KB Output is correct
34 Correct 0 ms 204 KB Output is correct
35 Correct 0 ms 204 KB Output is correct
36 Correct 1 ms 300 KB Output is correct
37 Correct 1 ms 332 KB Output is correct
38 Correct 1 ms 204 KB Output is correct
39 Correct 1 ms 280 KB Output is correct
40 Correct 1 ms 332 KB Output is correct
41 Correct 1 ms 204 KB Output is correct
42 Correct 0 ms 280 KB Output is correct
43 Correct 0 ms 204 KB Output is correct
44 Correct 1 ms 204 KB Output is correct
45 Correct 1 ms 292 KB Output is correct
46 Correct 0 ms 292 KB Output is correct
47 Correct 2 ms 332 KB Output is correct
48 Correct 0 ms 292 KB Output is correct
49 Correct 1 ms 204 KB Output is correct
50 Correct 6 ms 568 KB Output is correct
51 Correct 4 ms 460 KB Output is correct
52 Correct 5 ms 460 KB Output is correct
53 Correct 5 ms 460 KB Output is correct
54 Correct 3 ms 332 KB Output is correct
55 Correct 7 ms 588 KB Output is correct
56 Correct 9 ms 568 KB Output is correct
57 Correct 7 ms 588 KB Output is correct
58 Correct 0 ms 292 KB Output is correct
59 Correct 0 ms 204 KB Output is correct
60 Correct 1 ms 332 KB Output is correct
61 Correct 7 ms 460 KB Output is correct
62 Correct 3 ms 332 KB Output is correct
63 Correct 1 ms 332 KB Output is correct
64 Correct 1 ms 292 KB Output is correct
65 Correct 4 ms 460 KB Output is correct
66 Correct 0 ms 292 KB Output is correct
67 Correct 0 ms 260 KB Output is correct
68 Correct 1 ms 288 KB Output is correct
69 Correct 1 ms 204 KB Output is correct
70 Correct 2 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 292 KB Output is correct
3 Correct 0 ms 288 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 0 ms 204 KB Output is correct
23 Correct 0 ms 204 KB Output is correct
24 Correct 0 ms 292 KB Output is correct
25 Correct 0 ms 204 KB Output is correct
26 Correct 2 ms 288 KB Output is correct
27 Correct 1 ms 332 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 292 KB Output is correct
31 Correct 2 ms 332 KB Output is correct
32 Correct 2 ms 296 KB Output is correct
33 Correct 1 ms 296 KB Output is correct
34 Correct 0 ms 204 KB Output is correct
35 Correct 0 ms 204 KB Output is correct
36 Correct 1 ms 300 KB Output is correct
37 Correct 1 ms 332 KB Output is correct
38 Correct 1 ms 204 KB Output is correct
39 Correct 1 ms 280 KB Output is correct
40 Correct 1 ms 332 KB Output is correct
41 Correct 1 ms 204 KB Output is correct
42 Correct 0 ms 280 KB Output is correct
43 Correct 0 ms 204 KB Output is correct
44 Correct 1 ms 204 KB Output is correct
45 Correct 1 ms 292 KB Output is correct
46 Correct 0 ms 292 KB Output is correct
47 Correct 2 ms 332 KB Output is correct
48 Correct 0 ms 292 KB Output is correct
49 Correct 1 ms 204 KB Output is correct
50 Correct 6 ms 568 KB Output is correct
51 Correct 4 ms 460 KB Output is correct
52 Correct 5 ms 460 KB Output is correct
53 Correct 5 ms 460 KB Output is correct
54 Correct 3 ms 332 KB Output is correct
55 Correct 7 ms 588 KB Output is correct
56 Correct 9 ms 568 KB Output is correct
57 Correct 7 ms 588 KB Output is correct
58 Correct 0 ms 292 KB Output is correct
59 Correct 0 ms 204 KB Output is correct
60 Correct 1 ms 332 KB Output is correct
61 Correct 7 ms 460 KB Output is correct
62 Correct 3 ms 332 KB Output is correct
63 Correct 1 ms 332 KB Output is correct
64 Correct 1 ms 292 KB Output is correct
65 Correct 4 ms 460 KB Output is correct
66 Correct 0 ms 292 KB Output is correct
67 Correct 0 ms 260 KB Output is correct
68 Correct 1 ms 288 KB Output is correct
69 Correct 1 ms 204 KB Output is correct
70 Correct 2 ms 332 KB Output is correct
71 Correct 410 ms 11524 KB Output is correct
72 Correct 251 ms 9088 KB Output is correct
73 Correct 326 ms 10140 KB Output is correct
74 Correct 193 ms 7524 KB Output is correct
75 Correct 202 ms 7748 KB Output is correct
76 Correct 531 ms 14700 KB Output is correct
77 Correct 517 ms 13804 KB Output is correct
78 Correct 435 ms 12856 KB Output is correct
79 Correct 537 ms 12432 KB Output is correct
80 Correct 1 ms 288 KB Output is correct
81 Correct 1 ms 292 KB Output is correct
82 Correct 13 ms 716 KB Output is correct
83 Correct 117 ms 4052 KB Output is correct
84 Correct 110 ms 4068 KB Output is correct
85 Correct 42 ms 1628 KB Output is correct
86 Correct 1 ms 296 KB Output is correct
87 Correct 142 ms 4784 KB Output is correct
88 Correct 1 ms 204 KB Output is correct
89 Correct 1 ms 204 KB Output is correct
90 Correct 2 ms 204 KB Output is correct
91 Correct 40 ms 1820 KB Output is correct
92 Correct 177 ms 5260 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 292 KB Output is correct
3 Correct 0 ms 288 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 0 ms 204 KB Output is correct
23 Correct 0 ms 204 KB Output is correct
24 Correct 0 ms 292 KB Output is correct
25 Correct 0 ms 204 KB Output is correct
26 Correct 2 ms 288 KB Output is correct
27 Correct 1 ms 332 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 292 KB Output is correct
31 Correct 2 ms 332 KB Output is correct
32 Correct 2 ms 296 KB Output is correct
33 Correct 1 ms 296 KB Output is correct
34 Correct 0 ms 204 KB Output is correct
35 Correct 0 ms 204 KB Output is correct
36 Correct 1 ms 300 KB Output is correct
37 Correct 1 ms 332 KB Output is correct
38 Correct 1 ms 204 KB Output is correct
39 Correct 1 ms 280 KB Output is correct
40 Correct 1 ms 332 KB Output is correct
41 Correct 1 ms 204 KB Output is correct
42 Correct 0 ms 280 KB Output is correct
43 Correct 0 ms 204 KB Output is correct
44 Correct 1 ms 204 KB Output is correct
45 Correct 1 ms 292 KB Output is correct
46 Correct 0 ms 292 KB Output is correct
47 Correct 2 ms 332 KB Output is correct
48 Correct 0 ms 292 KB Output is correct
49 Correct 1 ms 204 KB Output is correct
50 Correct 6 ms 568 KB Output is correct
51 Correct 4 ms 460 KB Output is correct
52 Correct 5 ms 460 KB Output is correct
53 Correct 5 ms 460 KB Output is correct
54 Correct 3 ms 332 KB Output is correct
55 Correct 7 ms 588 KB Output is correct
56 Correct 9 ms 568 KB Output is correct
57 Correct 7 ms 588 KB Output is correct
58 Correct 0 ms 292 KB Output is correct
59 Correct 0 ms 204 KB Output is correct
60 Correct 1 ms 332 KB Output is correct
61 Correct 7 ms 460 KB Output is correct
62 Correct 3 ms 332 KB Output is correct
63 Correct 1 ms 332 KB Output is correct
64 Correct 1 ms 292 KB Output is correct
65 Correct 4 ms 460 KB Output is correct
66 Correct 0 ms 292 KB Output is correct
67 Correct 0 ms 260 KB Output is correct
68 Correct 1 ms 288 KB Output is correct
69 Correct 1 ms 204 KB Output is correct
70 Correct 2 ms 332 KB Output is correct
71 Correct 410 ms 11524 KB Output is correct
72 Correct 251 ms 9088 KB Output is correct
73 Correct 326 ms 10140 KB Output is correct
74 Correct 193 ms 7524 KB Output is correct
75 Correct 202 ms 7748 KB Output is correct
76 Correct 531 ms 14700 KB Output is correct
77 Correct 517 ms 13804 KB Output is correct
78 Correct 435 ms 12856 KB Output is correct
79 Correct 537 ms 12432 KB Output is correct
80 Correct 1 ms 288 KB Output is correct
81 Correct 1 ms 292 KB Output is correct
82 Correct 13 ms 716 KB Output is correct
83 Correct 117 ms 4052 KB Output is correct
84 Correct 110 ms 4068 KB Output is correct
85 Correct 42 ms 1628 KB Output is correct
86 Correct 1 ms 296 KB Output is correct
87 Correct 142 ms 4784 KB Output is correct
88 Correct 1 ms 204 KB Output is correct
89 Correct 1 ms 204 KB Output is correct
90 Correct 2 ms 204 KB Output is correct
91 Correct 40 ms 1820 KB Output is correct
92 Correct 177 ms 5260 KB Output is correct
93 Correct 2161 ms 39372 KB Output is correct
94 Correct 1410 ms 28920 KB Output is correct
95 Correct 1396 ms 30080 KB Output is correct
96 Correct 1117 ms 26564 KB Output is correct
97 Correct 1033 ms 24724 KB Output is correct
98 Correct 2512 ms 43872 KB Output is correct
99 Correct 2490 ms 44388 KB Output is correct
100 Correct 2486 ms 42540 KB Output is correct
101 Correct 2372 ms 42172 KB Output is correct
102 Correct 2114 ms 38544 KB Output is correct
103 Correct 1859 ms 34792 KB Output is correct
104 Correct 1 ms 204 KB Output is correct
105 Correct 1 ms 204 KB Output is correct
106 Correct 36 ms 1124 KB Output is correct
107 Correct 437 ms 10360 KB Output is correct
108 Correct 809 ms 17156 KB Output is correct
109 Correct 128 ms 3524 KB Output is correct
110 Correct 1 ms 204 KB Output is correct
111 Correct 463 ms 11372 KB Output is correct
112 Correct 1 ms 204 KB Output is correct
113 Correct 1 ms 296 KB Output is correct
114 Correct 14 ms 708 KB Output is correct
115 Correct 1 ms 204 KB Output is correct
116 Correct 43 ms 1456 KB Output is correct
117 Incorrect 656 ms 16636 KB Output isn't correct