# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
79957 | pzdba | Uzastopni (COCI17_uzastopni) | C++14 | 20 ms | 664 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int main(){
LL n;
scanf("%lld", &n);
for(LL i=2;i<=min(n, (LL)200000);i++){
LL lo = 1, hi = (n+i-1)/i;
LL ans = -1;
while(lo <= hi){
LL mid = (lo+hi)/2;
LL st = mid, en = mid+i-1;
LL le = en-st+1;
LL val = (st+en)*le/2;
if(val <= n){
if(val == n) ans = mid;
lo = mid+1;
}
else hi = mid-1;
}
if(ans != -1){
printf("%lld %lld\n", ans, ans+i-1);
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |