제출 #913229

#제출 시각아이디문제언어결과실행 시간메모리
913229dacashewCoreputer (IOI23_coreputer)C++17
0 / 100
1 ms344 KiB
#include "coreputer.h" #include <bits/stdc++.h> using namespace std; #define iloop(n) for(int i=0;i<n;i++) #define pb push_back #define pf push_front #define ppb pop_back #define ppf pop_front vector<int> malfunctioning_cores(int n){ int l=0,r=n-1; vector<int> a(n); a.clear(); iloop(n){ a.pb(0); } bool even=0; while(l<r){ vector<int> v; int mid=(l+r)/2; iloop(mid+1){ v.pb(i); } int temp=run_diagnostic(v); if(temp==0){ even=1; } if(temp>=0){ r=mid; } else{ l=mid+1; } } //l is the position of the most left computer st rd(0 to l) is 0 or 1 if(l==0){ vector<int> emptyv; emptyv.clear(); int temp=run_diagnostic(emptyv); if(temp==0){ return a; } else if(temp==-1){ a[0]=1; return a; } } a[l]=1; //cout<<even<<" "<<l<<endl; if(even){ int tot=1; vector<int> v; for(int i=0;i<=l;i++){ v.pb(i); } for(int i=l+1;i<n;i++){ v.pb(i); int temp=run_diagnostic(v); if(temp==1){ a[i]=1; tot++; } v.ppb(); } v.clear(); for(int i=l+1;i<n;i++){ v.pb(i); } for(int i=1;i<l;i++){ v.pb(i); int temp=run_diagnostic(v); if(temp==1){ a[i]=1; tot++; } v.ppb(); } if(tot%2==1){ a[0]=1; } return a; } else{ vector<int> v; int tot=1; for(int i=0;i<l;i++){ v.pb(i); } for(int i=l+1;i<n;i++){ v.pb(i); int temp=run_diagnostic(v); if(temp==1){ a[i]=1; tot++; } v.ppb(); } v.clear(); for(int i=l+1;i<n;i++){ v.pb(i); } for(int i=1;i<l;i++){ v.pb(i); int temp=run_diagnostic(v); if(temp==1){ a[i]=1; tot++; } v.ppb(); } if(tot%2==0){ a[0]=1; } return a; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...