Submission #424663

# Submission time Handle Problem Language Result Execution time Memory
424663 2021-06-12T08:53:38 Z A_D Toys (CEOI18_toy) C++14
0 / 100
0 ms 204 KB
#include <bits/stdc++.h>
#define int long long
#define ii pair<int,int>
#define F first
#define S second
#define du long double
using namespace std;
const int N=1e8+5;
bool freq[N];
vector<int> vec;
void solve()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            for(int k=1;k<=n;k++){
                if((i*j*k)==n){
                    if(freq[i+j+k])continue;
                    freq[i+j+k]=1;
                    cout<<i<<" "<<j<<" "<<k<<endl;
                }
            }
        }
    }
    /*
    for(int i=1;i<=n;i++){
        for(int j=1;j*i<=n;j++){
            int u=i*j;
            if(n%u==0){
                int v=n/u;
                if(freq[i+j+v])continue;
                cout<<i<<" "<<j<<" "<<v<<endl;
                freq[i+j+v]=1;
            }
        }
    }
    */
    for(int i=1;i<=n+3;i++){
        if(freq[i])vec.push_back(i-3);
    }
    int sz=vec.size();
    printf("%lld\n",sz);
    for(auto x:vec)printf("%lld ",x);
}
main()
{
    int t=1;
    //cin>>t;
    while(t--)solve();
}

Compilation message

toy.cpp:46:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   46 | main()
      | ^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -