# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
79957 | 2018-10-17T16:25:08 Z | pzdba | Uzastopni (COCI17_uzastopni) | C++14 | 20 ms | 664 KB |
#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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 392 KB | Output is correct |
3 | Correct | 2 ms | 440 KB | Output is correct |
4 | Correct | 4 ms | 552 KB | Output is correct |
5 | Correct | 6 ms | 552 KB | Output is correct |
6 | Correct | 8 ms | 552 KB | Output is correct |
7 | Correct | 9 ms | 636 KB | Output is correct |
8 | Correct | 11 ms | 636 KB | Output is correct |
9 | Correct | 14 ms | 636 KB | Output is correct |
10 | Correct | 20 ms | 664 KB | Output is correct |