Submission #1045525

#TimeUsernameProblemLanguageResultExecution timeMemory
1045525ezzzayOdd-even (IZhO11_oddeven)C++14
0 / 100
0 ms348 KiB
#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 timeMemoryGrader output
Fetching results...