Skip to content

Instantly share code, notes, and snippets.

@aluex
Created March 23, 2015 11:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aluex/7811a2bc37443fc0bf45 to your computer and use it in GitHub Desktop.
Save aluex/7811a2bc37443fc0bf45 to your computer and use it in GitHub Desktop.
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