Codeforces Round #473 (Div. 2), problem: (D) Mahmoud and Ehab and another array construction task Solution In C/C++

By |2018-04-18T13:26:56+06:00April 18th, 2018|Categories: C/C++, Programming|Tags: , , , , , , |

#include<stdio.h> int vi[10000001]={0}; int main(void) { int n, a, now = 2; int ans; scanf("%d", &n); int flag = 0; int i,j,k; for (i = 1; i <= n; i++) { scanf("%d", &a); ans = now; if (!flag&&a>ans) ans = a; while (vi[ans]) ans++; [...]