QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#357078 | #403. Memory2 | weajink2 | 100 ✓ | 1ms | 3856kb | C++14 | 1.6kb | 2024-03-18 18:06:51 | 2024-03-18 18:06:53 |
Judging History
answer
#include "Memory2_lib.h"
#include<bits/stdc++.h>
using namespace std;
int values[110];
void Solve(int T, int n){
if(n==1){
Answer(0,1, 0);
return;
}
int i;
for(i=0;i<2*n;i++)values[i] = -1;
int a, b, val;
a = 0, b = 1, val = Flip(a,b);
for(i=2;i<2*n;i++){
int c = Flip(a, i), d =Flip(b, i);
// printf("%d %d %d %d %d %d\n", a, b, i, val, c, d);
if(c==d && c==val){
// printf("gowno\n");
int e = Flip(b, i+1), f = Flip(i, i+1);
int j = i+1;
while(e==f && e!=val){
// printf("skip\n");
values[j] = e;
j++;
e = Flip(b, j);
f = Flip(i, j);
}
if(e==val && f==val){
// printf("g1\n");
values[b] = val;
values[i] = val;
a = a;
b = j;
val = Flip(a, b);
i=j;
continue;
}
if(e==val){
// printf("g2\n");
values[a] = val;
values[b] = val;
a = i;
b = j;
val = f;
i=j;
continue;
}
if(f==val){
// printf("g3\n");
values[a] = val;
values[i] = val;
a = b;
b = j;
val = e;
i=j;
continue;
}
continue;
}
if(c==d){
values[i] = c;
continue;
}
if(c==val){
values[a] = val;
a = i;
val = d;
continue;
}
if(d==val){
values[b] = val;
b = i;
val = c;
continue;
// printf("dobry case %d\n", val);
}
}
values[a] = val;
values[b] = val;
// for(i=0;i<2*n;i++)printf("%d ", values[i]);
for(i=0;i<n;i++){
int z1 = -1, z2 = -1;
for(int j=0;j<2*n;j++)
if(values[j]==i){
if(z1==-1)z1 = j;
else
z2 = j;
}
Answer(z1, z2, i);
}
return;
}
Details
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 1ms
memory: 3824kb
Test #2:
score: 0
Accepted
time: 1ms
memory: 3736kb
Test #3:
score: 0
Accepted
time: 1ms
memory: 3808kb
Test #4:
score: 0
Accepted
time: 1ms
memory: 3780kb
Test #5:
score: 0
Accepted
time: 0ms
memory: 3848kb
Test #6:
score: 0
Accepted
time: 0ms
memory: 3800kb
Test #7:
score: 0
Accepted
time: 0ms
memory: 3856kb
Test #8:
score: 0
Accepted
time: 0ms
memory: 3820kb
Subtask #2:
score: 50
Accepted
Test #9:
score: 50
Accepted
time: 0ms
memory: 3732kb
Test #10:
score: 0
Accepted
time: 0ms
memory: 3736kb
Test #11:
score: 0
Accepted
time: 0ms
memory: 3776kb
Test #12:
score: 0
Accepted
time: 1ms
memory: 3840kb
Test #13:
score: 0
Accepted
time: 0ms
memory: 3736kb
Test #14:
score: 0
Accepted
time: 0ms
memory: 3836kb
Test #15:
score: 0
Accepted
time: 0ms
memory: 3856kb
Test #16:
score: 0
Accepted
time: 0ms
memory: 3856kb
Test #17:
score: 0
Accepted
time: 0ms
memory: 3848kb
Test #18:
score: 0
Accepted
time: 0ms
memory: 3780kb
Subtask #3:
score: 40
Accepted
Test #19:
score: 40
Accepted
time: 0ms
memory: 3820kb
Test #20:
score: 0
Accepted
time: 0ms
memory: 3804kb
Test #21:
score: 0
Accepted
time: 0ms
memory: 3804kb
Test #22:
score: 0
Accepted
time: 1ms
memory: 3848kb
Test #23:
score: 0
Accepted
time: 0ms
memory: 3800kb
Test #24:
score: 0
Accepted
time: 1ms
memory: 3776kb
Test #25:
score: 0
Accepted
time: 0ms
memory: 3780kb
Test #26:
score: 0
Accepted
time: 1ms
memory: 3728kb
Test #27:
score: 0
Accepted
time: 0ms
memory: 3816kb
Test #28:
score: 0
Accepted
time: 0ms
memory: 3828kb
Extra Test:
score: 0
Extra Test Passed