Moved kattis from Uni repo

This commit is contained in:
2023-12-01 13:35:13 +01:00
parent 28a6b807a3
commit aaa2c123b8
164 changed files with 3008 additions and 0 deletions

View File

View File

@ -0,0 +1,30 @@
#include <stdio.h>
#include <stdlib.h>
#define MAX 100001
int main(int argc, char **argv) {
int n;
scanf("%d", &n);
int locations[MAX] = {0};
for (int i = 1; i <= n; ++i) {
scanf("%d", &locations[i]);
}
int temp = 0;
for (int i = 1; i <= n; ++i) {
if (locations[i] == i) {
continue;
}
temp = locations[i];
locations[i] = locations[temp];
locations[temp] = temp;
}
return 0;
}

View File

@ -0,0 +1,18 @@
#include <stdio.h>
#include <stdlib.h>
#define MAX 100001
int main(int argc, char **argv) {
int n;
scanf("%d", &n);
int locations[MAX] = {0};
for (int i = 0; i < n; ++i) {
scanf("%d", &locations[i]);
}
for (int i = 0; i < n; ++i) {
printf("%d ", locations[i]);
}
return 0;
}

Binary file not shown.