Submission #1406212


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

vector<int> p({2,3,5,7,11,13,17,19,23,29,31,37,41,43,47});
ll n;
ll ax,ay;

void dfs(int idx, int lim, ll x, ll y)
{
    if(idx==p.size()) return;

    if(x>ax || (x==ax&&y<ay))
    {
        ax=x;
        ay=y;
    }

    for(int i=1; i<=lim; ++i)
    {
        if(y*p[idx]>n) break;
        dfs(idx+1,i,x*(i+1),y*p[idx]);
        y*=p[idx];
    }
}

int main()
{
    int Q;
    scanf(" %d", &Q);
    while(Q--)
    {
        scanf(" %lld",&n);

        ax=ay=1;
        dfs(0,60,1,1);
        printf("%lld %lld\n", ax, ay);
    }
    return 0;
}

Submission Info

Submission Time
Task D - 2016
User imulan
Language C++14 (GCC 5.4.1)
Score 100
Code Size 1086 Byte
Status AC
Exec Time 132 ms
Memory 256 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:38:21: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf(" %d", &Q);
                     ^
./Main.cpp:41:26: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
         scanf(" %lld",&n);
                          ^

Judge Result

Set Name Sample Subtask1 Subtask2 Subtask3
Score / Max Score 0 / 0 8 / 8 34 / 34 58 / 58
Status
AC × 4
AC × 8
AC × 12
AC × 16
Set Name Test Cases
Sample sample_1.txt, sample_2.txt, sample_3.txt, sample_4.txt
Subtask1 sample_1.txt, sample_2.txt, sample_3.txt, sample_4.txt, sub1_1.txt, sub1_2.txt, sub1_3.txt, sub1_4.txt
Subtask2 sample_1.txt, sample_2.txt, sample_3.txt, sample_4.txt, sub1_1.txt, sub1_2.txt, sub1_3.txt, sub1_4.txt, sub2_1.txt, sub2_2.txt, sub2_3.txt, sub2_4.txt
Subtask3 sample_1.txt, sample_2.txt, sample_3.txt, sample_4.txt, sub1_1.txt, sub1_2.txt, sub1_3.txt, sub1_4.txt, sub2_1.txt, sub2_2.txt, sub2_3.txt, sub2_4.txt, sub3_1.txt, sub3_2.txt, sub3_3.txt, sub3_4.txt
Case Name Status Exec Time Memory
sample_1.txt AC 1 ms 256 KB
sample_2.txt AC 1 ms 256 KB
sample_3.txt AC 1 ms 256 KB
sample_4.txt AC 1 ms 256 KB
sub1_1.txt AC 1 ms 256 KB
sub1_2.txt AC 1 ms 256 KB
sub1_3.txt AC 1 ms 256 KB
sub1_4.txt AC 1 ms 256 KB
sub2_1.txt AC 2 ms 256 KB
sub2_2.txt AC 2 ms 256 KB
sub2_3.txt AC 2 ms 256 KB
sub2_4.txt AC 2 ms 256 KB
sub3_1.txt AC 9 ms 256 KB
sub3_2.txt AC 9 ms 256 KB
sub3_3.txt AC 131 ms 256 KB
sub3_4.txt AC 132 ms 256 KB