hi guys, Im new to codeforce. My question is for problem# 318A EVEN ODD I've used ordered map in this question but not getting the answer. Please do let me know where Im wrong........
int main() { int i, j; map<int, int> m; int n, k; cin>>n>>k;
for (i =1, j=1; j <=n; i++, j+2) { m[i]= j; } for (i, j=2; j <=n; i++, j+2) { m[i]= j; } auto it= m.find(k); if(it!=m.end()) { cout<<endl<<(*it).second; }
}
the number n has upper limit of 10^12 which is hard to store, you have to find a way to do this task without any data structure.
if you search about limits for datatypes in c++ ,it will help you to solve it