1
0
Fork 0

maxep is only 25% AC )-:

This commit is contained in:
Nguyễn Gia Phong 2018-12-12 01:10:38 +07:00
parent 054428243c
commit 5e48d2ec45
4 changed files with 107 additions and 0 deletions

4
codechef/chfideal.lua Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env lua
print(1)
io.flush()
print(io.read('*n') == 2 and 3 or 2)

3
codechef/chfintro.lua Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env lua
local n, r = io.read('*n', '*n')
for i = 1, n do print(io.read('*n') >= r and 'Good boi' or 'Bad boi') end

74
codechef/intxor.c Normal file
View File

@ -0,0 +1,74 @@
#include <stdio.h>
/* For the sake of performance */
long a[50000], b[50000];
void longxor(long n)
{
long i, all = 0, almost = 0, vacancy = 0;
for (i = 0; i < n; i++) {
printf("1 %ld %ld %ld\n",
i + 1, (i + 1) % n + 1, (i + 2) % n + 1);
fflush(stdout);
scanf("%ld", b + i);
all ^= b[i];
}
for (i = 2 - n % 3; i < n; i += 3)
almost ^= b[i];
for (i = 0; i < n; i++) {
a[vacancy] = all ^ almost;
all ^= b[vacancy] ^ b[(vacancy + 1) % n];
vacancy = (vacancy + 3) % n;
}
}
void fourxor(long n)
{
printf("1 %ld %ld %ld\n", n - 2, n - 1, n);
fflush(stdout);
scanf("%ld", b);
printf("1 %ld %ld %ld\n", n - 3, n - 1, n);
fflush(stdout);
scanf("%ld", b + 1);
printf("1 %ld %ld %ld\n", n - 3, n - 2, n);
fflush(stdout);
scanf("%ld", b + 2);
printf("1 %ld %ld %ld\n", n - 3, n - 2, n - 1);
fflush(stdout);
scanf("%ld", b + 3);
long all = b[0] ^ b[1] ^ b[2] ^ b[3];
a[n - 4] = all ^ b[0];
a[n - 3] = all ^ b[1];
a[n - 2] = all ^ b[2];
a[n - 1] = all ^ b[3];
}
int main()
{
long t, n, i = 1;
scanf("%ld", &t);
while (t-- && i == 1) {
scanf("%ld", &n);
if (n % 3) {
longxor(n);
} else {
longxor(n - 4);
fourxor(n);
}
putchar(50);
for (i = 0; i < n; i++)
printf(" %ld", a[i]);
putchar(10);
fflush(stdout);
scanf("%ld", &i);
}
return 0;
}

26
codechef/maxep.c Normal file
View File

@ -0,0 +1,26 @@
#include <stdio.h>
int main()
{
long x = 1, y, n;
int b, c, left = 1000;
scanf("%ld %d", &n, &c);
while (--left >= c && x < n) {
printf("1 %ld\n", y = (x + n) / 2);
fflush(stdout);
scanf("%d", &b);
if (b) {
puts("2");
fflush(stdout);
left -= c;
n = y;
} else {
x = y + 1;
}
}
printf("3 %ld\n", x);
return 0;
}