# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1045525 | ezzzay | Odd-even (IZhO11_oddeven) | C++14 | 0 ms | 348 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;
#define int long long
#define ff first
#define ss second
#define pb push_back
const int N=3e5+5;
vector<int>ans;
int a[N];
signed main(){
int n;
cin>>n;
int h=sqrt(n*2);
if(h*(h+1)/2<n)h++;
//cout<<h;
if(h*(h+1)/2==n){
cout<<h*h;
}
else{
cout<<h*h-(h*(h+1)/2-n)*2;
}
return 0;
cout<<endl;
int k=1;
for(int i=1;i<=n;i++){
for(int j=1;j<=i;j++){
cout<< k <<" ";
k+=2;
}
k--;;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |