#include <stdio.h>
#include <string.h>
#define TEST 1
void permute(int *s, int start, int end);
void swap(int *s, int start, int end);
void startTesting();
int main(void) {
#ifdef TEST
startTesting();
#endif
return 0;
}
void swap(int *s, int start, int end) {
int temp = s[start];
s[start] = s[end];
s[end] = temp;
}
void permute(int *s, int start, int end)
{
int i = 0;
int j = 0;
if (start == end) {
for (i = 0; i < 4; i++) {
}
} else {
for (j = start; j <= end; j++) {
swap(s, start, j);
permute(s, start + 1, end);
swap(s, start, j);
}
}
}
void test1()
{
int s[] = {1, 2, 3, 4};
int i = 0;
for (i = 0; i < 4; i++) {
}
permute(s, 0, 3);
}
void startTesting()
{
test1();
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdHJpbmcuaD4KCiNkZWZpbmUgVEVTVCAxCgp2b2lkIHBlcm11dGUoaW50ICpzLCBpbnQgc3RhcnQsIGludCBlbmQpOwp2b2lkIHN3YXAoaW50ICpzLCBpbnQgc3RhcnQsIGludCBlbmQpOwp2b2lkIHN0YXJ0VGVzdGluZygpOwoKaW50IG1haW4odm9pZCkgewojaWZkZWYgVEVTVAogICAgc3RhcnRUZXN0aW5nKCk7CiNlbmRpZgoKICAgIHJldHVybiAwOwp9Cgp2b2lkIHN3YXAoaW50ICpzLCBpbnQgc3RhcnQsIGludCBlbmQpIHsKICAgIGludCB0ZW1wID0gc1tzdGFydF07CiAgICBzW3N0YXJ0XSA9IHNbZW5kXTsKICAgIHNbZW5kXSA9IHRlbXA7Cn0KCnZvaWQgcGVybXV0ZShpbnQgKnMsIGludCBzdGFydCwgaW50IGVuZCkKewogICAgaW50IGkgPSAwOwogICAgaW50IGogPSAwOwoKICAgIGlmIChzdGFydCA9PSBlbmQpIHsKICAgICAgICBmb3IgKGkgPSAwOyBpIDwgNDsgaSsrKSB7CiAgICAgICAgICAgIHByaW50ZigiJWQgIiwgc1tpXSk7CiAgICAgICAgfQogICAgICAgIHByaW50ZigiXG4iKTsKICAgIH0gZWxzZSB7CiAgICAgICAgZm9yIChqID0gc3RhcnQ7IGogPD0gZW5kOyBqKyspIHsKICAgICAgICAgICAgc3dhcChzLCBzdGFydCwgaik7CiAgICAgICAgICAgIHBlcm11dGUocywgc3RhcnQgKyAxLCBlbmQpOwogICAgICAgICAgICBzd2FwKHMsIHN0YXJ0LCBqKTsKICAgICAgICB9CiAgICB9Cn0KCnZvaWQgdGVzdDEoKQp7CiAgICBpbnQgc1tdID0gezEsIDIsIDMsIDR9OwogICAgaW50IGkgPSAwOwoKICAgIHByaW50ZigicGVybXV0ZSBcbiIpOwogICAgZm9yIChpID0gMDsgaSA8IDQ7IGkrKykgewogICAgICAgIHByaW50ZigiJWQgIiwgc1tpXSk7CiAgICB9CiAgICBwcmludGYoIlxuIik7CgogICAgcGVybXV0ZShzLCAwLCAzKTsKICAgIHByaW50ZigiXG4iKTsKfQoKdm9pZCBzdGFydFRlc3RpbmcoKQp7CiAgICB0ZXN0MSgpOwp9Cg==