# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
714117 | DepressedMG | Uzastopni (COCI17_uzastopni) | C++17 | 40 ms | 65536 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>
#define ull unsigned long long
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ull n,m,a,b,i,j;
cin>>n;
vector<ull> v(n/2+3);
v[0]=0;
for(i=1;i<v.size();i++){
v[i]=v[i-1]+i;
}
j=v.size()-2;
for(i=v.size();i>0 && j>0;){
if(v[i]-v[j]<n){
j--;
}
else{
if(v[i]-v[j]>n){
i--;
}
else{
cout<<j+1<<" "<<i<<endl;
j--;i--;
}
}
}
if(v[i]-v[j]<n){
j--;
}
else{
if(v[i]-v[j]>n){
i--;
}
else{
cout<<j+1<<" "<<i<<endl;
j--;i--;
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |