제출 #286209

#제출 시각아이디문제언어결과실행 시간메모리
286209user202729장난감 기차 (IOI17_train)C++17
10 / 100
11 ms896 KiB
// moreflags=grader.cpp // // 13 // still unproven. // #include "train.h" std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) { if(a.size()>15) return {}; std::vector<int> adjacent(a.size()); for(int index=0; index<(int)u.size(); ++index){ adjacent[u[index]]|=1<<v[index]; } int noChargeMask=0; for(int node=0; node<(int)r.size(); ++node) if(not r[node]) noChargeMask|=1<<node; auto const contains=[&](int large, int small){ return (large&small)==small; }; int bwin{}; for(int _=0; _<(int)a.size()+1; ++_){ for(int mask=noChargeMask; mask; mask=(mask-1)&noChargeMask){ for(int node=0; node<(int)a.size(); ++node) if(mask>>node&1){ if(a[node]){ if(not contains(mask|bwin, adjacent[node])) goto next_mask; }else{ if(((mask|bwin)&adjacent[node])==0) goto next_mask; } } bwin|=mask; next_mask:; } for(int node=0; node<(int)a.size(); ++node) if(a[node]){ if(contains(bwin, adjacent[node])) bwin|=1<<node; }else{ if((bwin&adjacent[node])!=0) bwin|=1<<node; } } std::vector<int> result(a.size()); for(int node=0; node<(int)a.size(); ++node) result[node]=not(bwin>>node&1); return result; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...