QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#357319 | #403. Memory2 | burzmixx | 100 ✓ | 1ms | 3996kb | C++14 | 2.1kb | 2024-03-18 20:09:25 | 2024-03-18 20:09:26 |
Judging History
answer
#include<bits/stdc++.h>
#include "Memory2_lib.h"
#define MAXN 52
using namespace std;
int zlicz[MAXN];
pair<int, int> F[MAXN];
bool czyzrobione[MAXN << 1];
void pre(){
for(int i = 0 ; i < MAXN ; ++ i){
F[i].first = - 1;
F[i].second = - 1;
czyzrobione[i] = false;
}
}
void Solve(int T, int N){
pre();
vector<pair<int,int>> V;
int pom;
for(int i = 0 ; i < 2 * N ; ++ i){
while(czyzrobione[i] && i < 2 * N){++ i;}
if(i >= 2 * N){break;}
V.clear();
for(int o = i + 1 ; o < 2 * N ; ++ o){
while(czyzrobione[o] && o < 2*N){++ o;}
if(o >= 2 * N){break;}
int t = Flip(i, o);
V.push_back({t, o});
++ zlicz[t];
if(zlicz[t] == 3){
zlicz[t] = 1;
if(F[t].first == -1){
F[t].first = i;
}else{
F[t].second = i;
}
for(int j = 0 ; j < V.size() ; ++ j){
if(V[j].first != t){
if(F[V[j].first].first == -1){
F[V[j].first].first = V[j].second;
}else{
F[V[j].first].second = V[j].second;
}
czyzrobione[V[j].second] = true;
}
}
break;
}
if(o == 2 * N - 1){
for(int j = 0 ; j < V.size() ; ++ j){
if(F[V[j].first].first == -1){
F[V[j].first].first = V[j].second;
}else{
F[V[j].first].second = V[j].second;
}
czyzrobione[V[j].second] = true;
}
pom = i;
}
}
}
for(int i = 0 ; i < N ; ++ i){
if(F[i].first == -1) F[i].first = pom;
else if(F[i].second == -1) F[i].second = pom;
Answer(F[i].first, F[i].second, i);
}
}
詳細信息
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 0ms
memory: 3600kb
Test #2:
score: 0
Accepted
time: 0ms
memory: 3764kb
Test #3:
score: 0
Accepted
time: 0ms
memory: 3956kb
Test #4:
score: 0
Accepted
time: 1ms
memory: 3708kb
Test #5:
score: 0
Accepted
time: 0ms
memory: 3952kb
Test #6:
score: 0
Accepted
time: 1ms
memory: 3792kb
Test #7:
score: 0
Accepted
time: 0ms
memory: 3704kb
Test #8:
score: 0
Accepted
time: 1ms
memory: 3712kb
Subtask #2:
score: 50
Accepted
Test #9:
score: 50
Accepted
time: 0ms
memory: 3756kb
Test #10:
score: 0
Accepted
time: 0ms
memory: 3996kb
Test #11:
score: 0
Accepted
time: 0ms
memory: 3708kb
Test #12:
score: 0
Accepted
time: 0ms
memory: 3756kb
Test #13:
score: 0
Accepted
time: 0ms
memory: 3796kb
Test #14:
score: 0
Accepted
time: 0ms
memory: 3984kb
Test #15:
score: 0
Accepted
time: 0ms
memory: 3772kb
Test #16:
score: 0
Accepted
time: 0ms
memory: 3704kb
Test #17:
score: 0
Accepted
time: 1ms
memory: 3752kb
Test #18:
score: 0
Accepted
time: 0ms
memory: 3800kb
Subtask #3:
score: 40
Accepted
Test #19:
score: 40
Accepted
time: 0ms
memory: 3772kb
Test #20:
score: 0
Accepted
time: 0ms
memory: 3988kb
Test #21:
score: 0
Accepted
time: 0ms
memory: 3792kb
Test #22:
score: 0
Accepted
time: 0ms
memory: 3756kb
Test #23:
score: 0
Accepted
time: 0ms
memory: 3760kb
Test #24:
score: 0
Accepted
time: 0ms
memory: 3700kb
Test #25:
score: 0
Accepted
time: 0ms
memory: 3756kb
Test #26:
score: 0
Accepted
time: 0ms
memory: 3692kb
Test #27:
score: 0
Accepted
time: 0ms
memory: 3712kb
Test #28:
score: 0
Accepted
time: 1ms
memory: 3752kb
Extra Test:
score: 0
Extra Test Passed