Moved kattis from Uni repo
This commit is contained in:
0
kattis/problems/27_10_23/rodunarrugl/1
Normal file
0
kattis/problems/27_10_23/rodunarrugl/1
Normal file
30
kattis/problems/27_10_23/rodunarrugl/main.c
Normal file
30
kattis/problems/27_10_23/rodunarrugl/main.c
Normal 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;
|
||||
}
|
18
kattis/problems/27_10_23/rodunarrugl/main.c.orig
Normal file
18
kattis/problems/27_10_23/rodunarrugl/main.c.orig
Normal 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;
|
||||
}
|
BIN
kattis/problems/27_10_23/rodunarrugl/program
Executable file
BIN
kattis/problems/27_10_23/rodunarrugl/program
Executable file
Binary file not shown.
Reference in New Issue
Block a user