Skip to content

Instantly share code, notes, and snippets.

@vipul43
Created July 20, 2020 10:22
Show Gist options
  • Save vipul43/3cc55d0218b18579205bb2f3201d307f to your computer and use it in GitHub Desktop.
Save vipul43/3cc55d0218b18579205bb2f3201d307f to your computer and use it in GitHub Desktop.
cses day1 problems solutions
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
void solution(){
int n;
cin >> n;
if(n==1){
cout << 1 << endl;
} else if(n<=3){
cout << "NO SOLUTION" << endl;
} else{
for(int i=0; i<n; i++){
if((i+1)%2==0){
cout << i+1 << " ";
}
}
for(int i=0; i<n; i++){
if((i+1)%2==1){
cout << i+1 << " ";
}
}
cout << "\n";
}
}
int main() {
int T=1;
// cin >> T;
for(int t=0; t<T; t++) {
solution();
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment