제출 #872829

#제출 시각아이디문제언어결과실행 시간메모리
872829bobbilykingToys (CEOI18_toy)C++17
79 / 100
5033 ms54168 KiB

#pragma GCC target ("avx2")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
 
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
 
typedef int ll;
typedef long double ld;
typedef pair<ll, ll> pl;
 
#define K first
#define V second
#define G(x) ll x; cin >> x;
#define GD(x) ld x; cin >> x;
#define GS(s) string s; cin >> s;
#define EX(x) { cout << x << '\n'; exit(0); }
#define A(a) (a).begin(), (a).end()
#define F(i, l, r) for (ll i = (l); i < r; ++i)
 
using dp_t=array<ll, 10>;

set<pl> dp;
set<ll> vis;
 
void dfs(ll n, ll sm){
    if (n == 1) {
        vis.insert(sm); 
        return;
    }
    if (dp.count({n, sm})) return;
    dp.emplace(n, sm);
    for (ll i = 2; i *i <=n ;++i) if (n%i == 0) {
        dfs(n/i, sm + i-1); dfs(i, sm + n/i-1); 
    }
    vis.insert(sm+n-1);
}
 
int main(){
//    freopen("a.in", "r", stdin);
//    freopen("a.out", "w", stdout);
 
    ios_base::sync_with_stdio(false); cin.tie(0);
    cout << fixed << setprecision(20);
    G(n)
    
    dfs(n, 0);
 
    cout << vis.size() << '\n';
    for (auto x: vis) cout << x << " "; cout << '\n';
}

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

toy.cpp: In function 'int main()':
toy.cpp:52:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   52 |     for (auto x: vis) cout << x << " "; cout << '\n';
      |     ^~~
toy.cpp:52:41: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   52 |     for (auto x: vis) cout << x << " "; cout << '\n';
      |                                         ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...