Submission #155194

#TimeUsernameProblemLanguageResultExecution timeMemory
155194phillipUzastopni (COCI17_uzastopni)C++14
48 / 80
263 ms380 KiB
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll n,o=1000009;
int main()
{
    cin>>n;
    for(ll j=1;j<min(n,o);j++)
    {
        ll i=j;
        ll l=i,r=n+1;
        while(r-l>1)
        {
            ll m=(l+r)/2,x=(m*(m+1))/2-(i*(i-1))/2;
            if(x==n)
            {
                cout<<i<<" "<<m<<"\n";
                break;
            }
            else if(x<n)l=m;
            else r=m;
        }

    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...