#include <bits/stdc++.h>
#define sts stable_sort
#define B begin()
#define rB rbegin()
#define E end()
#define rE rend()
#define F first
#define S second
#define pb push_back
#define ppb pop_back()
#define pf push_front
#define ppf pop_front()
#define eb emplace_back
#define ll long long
#define ui unsigned int
#define ull unsigned long long
using namespace std;
const int MAXN = 1e6 + 4;
const int MOD = 1e9 + 7;
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
ll n; cin >> n;
ll l = 1, r = l + 1;
ll sum = l + r;
vector<pair<ll,ll> > v;
while(l <= n / 2){
if(sum == n){
v.pb({l, r});
l++; r = l + 1; sum = l + r;
}else if(sum > n){
l++; r = l + 1; sum = l + r;
}else{
r++; sum += r;
}
}
for(auto &c : v){
cout << c.F << " " << c.S << "\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
316 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
2 ms |
324 KB |
Output is correct |
6 |
Correct |
13 ms |
212 KB |
Output is correct |
7 |
Correct |
67 ms |
212 KB |
Output is correct |
8 |
Correct |
716 ms |
308 KB |
Output is correct |
9 |
Execution timed out |
1078 ms |
212 KB |
Time limit exceeded |
10 |
Execution timed out |
1085 ms |
212 KB |
Time limit exceeded |