#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 time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
10 ms |
256 KB |
Output is correct |
5 |
Correct |
21 ms |
256 KB |
Output is correct |
6 |
Correct |
132 ms |
376 KB |
Output is correct |
7 |
Incorrect |
148 ms |
256 KB |
Output isn't correct |
8 |
Incorrect |
172 ms |
380 KB |
Output isn't correct |
9 |
Incorrect |
201 ms |
368 KB |
Output isn't correct |
10 |
Incorrect |
263 ms |
376 KB |
Output isn't correct |