QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#357449 | #403. Memory2 | debildebil | 100 ✓ | 1ms | 3872kb | C++23 | 1.4kb | 2024-03-18 21:21:17 | 2024-03-18 21:21:18 |
Judging History
answer
#include<bits/stdc++.h>
#include "Memory2_lib.h"
using namespace std;
const int N = 1008;
int n;
int val[N];
int wyst[N];
int quer[N];
vector<int> odp[N];
int licznik=0;
void routine(int m){
for(int i=0; i<2*n; i++){
wyst[i]=0;
quer[i]=-1;
}
for(int i=0; i<2*n; i++){
if(i==m) continue;
if(val[i]>=0){
wyst[val[i]]++;
if(wyst[val[i]]>=3) break;
continue;
}
int wartosc = Flip(m, i);
quer[i]=wartosc;
wyst[wartosc]++;
if(wyst[wartosc]>=3) break;
}
for(int i=0; i<n; i++){
if(wyst[i]%2==1){
val[m]=i;
}
}
for(int i=0; i<n; i++){
if(wyst[i]>2) val[m]=i;
}
for(int i=0; i<2*n; i++){
if(quer[i]!=-1&&quer[i]!=val[m]) val[i] = quer[i];
}
}
void Solve(int T, int inn){
n=inn;
if(n==1){
Answer(0, 1, 0);
return;
}
for(int i=0; i<2*n; i++) val[i] = -1;
for(int i=0; i<2*n; i++){
if(val[i]==-1) routine(i);
}
for(int i=0; i<2*n; i++){
if(val[i]<0) Answer(0, 0, 0);
odp[val[i]].push_back(i);
if(odp[val[i]].size()>2) Answer(0, 0, 0);
}
for(int i=0; i<n; i++){
if(odp[i].size()<2) Answer(0, 0, 0);
Answer(odp[i][0], odp[i][1], i);
odp[i].clear();
}
}
詳細信息
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 1ms
memory: 3820kb
Test #2:
score: 0
Accepted
time: 0ms
memory: 3756kb
Test #3:
score: 0
Accepted
time: 1ms
memory: 3816kb
Test #4:
score: 0
Accepted
time: 0ms
memory: 3748kb
Test #5:
score: 0
Accepted
time: 0ms
memory: 3832kb
Test #6:
score: 0
Accepted
time: 0ms
memory: 3872kb
Test #7:
score: 0
Accepted
time: 0ms
memory: 3736kb
Test #8:
score: 0
Accepted
time: 1ms
memory: 3856kb
Subtask #2:
score: 50
Accepted
Test #9:
score: 50
Accepted
time: 1ms
memory: 3752kb
Test #10:
score: 0
Accepted
time: 1ms
memory: 3820kb
Test #11:
score: 0
Accepted
time: 0ms
memory: 3792kb
Test #12:
score: 0
Accepted
time: 1ms
memory: 3752kb
Test #13:
score: 0
Accepted
time: 1ms
memory: 3820kb
Test #14:
score: 0
Accepted
time: 0ms
memory: 3832kb
Test #15:
score: 0
Accepted
time: 0ms
memory: 3836kb
Test #16:
score: 0
Accepted
time: 0ms
memory: 3736kb
Test #17:
score: 0
Accepted
time: 0ms
memory: 3800kb
Test #18:
score: 0
Accepted
time: 0ms
memory: 3828kb
Subtask #3:
score: 40
Accepted
Test #19:
score: 40
Accepted
time: 0ms
memory: 3840kb
Test #20:
score: 0
Accepted
time: 1ms
memory: 3756kb
Test #21:
score: 0
Accepted
time: 0ms
memory: 3752kb
Test #22:
score: 0
Accepted
time: 1ms
memory: 3868kb
Test #23:
score: 0
Accepted
time: 1ms
memory: 3748kb
Test #24:
score: 0
Accepted
time: 0ms
memory: 3836kb
Test #25:
score: 0
Accepted
time: 0ms
memory: 3752kb
Test #26:
score: 0
Accepted
time: 0ms
memory: 3792kb
Test #27:
score: 0
Accepted
time: 0ms
memory: 3736kb
Test #28:
score: 0
Accepted
time: 0ms
memory: 3836kb
Extra Test:
score: 0
Extra Test Passed