Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Solution to redundant_code
// Credit: token
#include <cstdio>
int cnt[1000000];
int n, m;
int buf;
int main()
{
FILE *key = fopen("output", "r");
fscanf(key, "%d%d", &n, &m);
for (int i = 0; i < 2 * m; i++)
fscanf(key, "%d", &buf),
cnt[buf]++;
int now = 1;
while (now < n)
{
int k = cnt[now] / 2;
printf("%c", '0' + k);
now += (k + 2) * (k + 1) / 2;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment