# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
908280 | zyq181 | Coreputer (IOI23_coreputer) | C++17 | 1 ms | 344 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "coreputer.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> malfunctioning_cores(int N){
if(N == 2){
if(run_diagnostic({0}) == 1){
return {0};
}
else if(run_diagnostic({0}) == -1){
return {1};
}
else{
return {0, 1};
}
}
vector<int> them;
vector<int> q;
int ret;
int cur;
for(int a=0; a<N; a+=2){
q.push_back(a);
}
ret = run_diagnostic(q);
if(ret == 1){
int t;
q.clear();
for(int a=1; a<N; a+=2) q.push_back(a);
for(int a=0; a<N; a+=2){
q.push_back(a);
t = run_diagnostic(q);
if(t != -1){
cur = a;
them.push_back(a);
break;
}
}
for(int a=cur+2; a<N; a+=2){
q.pop_back();
q.push_back(a);
if(run_diagnostic(q) != -1){
them.push_back(a);
}
}
int k = them.size();
if(t == 0){
k--;
}
q.clear();
for(int a=0; a<k-1; a++){
q.push_back(them[a]);
}
q.push_back(0);
for(int a=1; a<N; a+=2){
q.pop_back();
q.push_back(a);
if(run_diagnostic(q) != -1) them.push_back(a);
}
}
else if(ret == -1){
int t;
for(int a=1; a<N; a+=2){
q.push_back(a);
t = run_diagnostic(q);
if(t != -1){
cur = a;
them.push_back(a);
break;
}
}
for(int a=cur+2; a<N; a+=2){
q.pop_back();
q.push_back(a);
if(run_diagnostic(q) != -1){
them.push_back(a);
}
}
int k = them.size();
if(t == 0){
k--;
}
q.clear();
for(int a=0; a<k-1; a++){
q.push_back(them[a]);
}
q.push_back(0);
for(int a=0; a<N; a+=2){
q.pop_back();
q.push_back(a);
if(run_diagnostic(q) != -1) them.push_back(a);
}
}
else{
q.push_back(1);
for(int a=1; a<N; a+=2){
q.pop_back();
q.push_back(a);
if(run_diagnostic(q) != 0) them.push_back(a);
}
int k = them.size();
q.clear();
for(int a=0; a<k-1; a++){
q.push_back(them[a]);
}
q.push_back(0);
for(int a=0; a<N; a+=2){
q.pop_back();
q.push_back(a);
if(run_diagnostic(q) != -1) them.push_back(a);
}
}
sort(them.begin(), them.end(), greater<int>());
vector<int> r;
for(int a=0; a<N; a++){
if(them.back() == a){
r.push_back(1);
them.pop_back();
}
else{
r.push_back(0);
}
}
return r;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |