제출 #260134

#제출 시각아이디문제언어결과실행 시간메모리
260134user202729코알라 (APIO17_koala)C++17
33 / 100
77 ms384 KiB
// moreflags=grader.cpp // 6 #include "koala.h" #if not LOCAL #define NDEBUG #endif #include<vector> #include<cassert> #include<algorithm> std::vector<int>& play(std::vector<int>& data, std::vector<int>& result){ assert(result.size()==data.size()); playRound(data.data(), result.data()); return result; } std::vector<int> play(std::vector<int>& data){ std::vector<int> result(data.size()); play(data, result); return result; } int minValue(int N, int W) { assert(N==W); std::vector<int> data(N); data[0]=1; auto result=play(data); for(int i=0; i<N; ++i) if(result[i]<=data[i]) return i; } int maxValue(int N, int W) { std::vector<int> data(N, 1); std::vector<int> result(N); while(true){ auto c=std::count_if(begin(data), end(data),[&](int it){return it>0;}); if(c==1) return int(std::find_if(begin(data), end(data),[&](int it){return it>0;})-data.begin()); int value=W/c; while([&]{ int tmp=0; for(int i=N-c; i>N-c-value; --i) tmp+=i; return tmp; }()>=N) { --value; assert(value>=1); } for(auto& it: data) if(it>0) it=W/c; play(data, result); for(int i=0; i<N; ++i) if(result[i]<=data[i]) data[i]=0; } } int greaterValue(int N, int W) { std::vector<int> data(N), result(N); int k=0; for(auto step=1<<4;;){ step>>=1; assert(step!=0); data[0]=data[1]=k+step; play(data, result); if(result[0]>data[0] and result[1]>data[1]){ k+=step; }else if(result[0]<=data[0] and result[1]<=data[1]){ }else{ if(result[0]>data[0]) return 0; else return 1; } } } void allValues(int N, int W, int *P) { if (W == 2*N) { // TODO: Implement Subtask 4 solution here. // You may leave this block unmodified if you are not attempting this // subtask. } else { // TODO: Implement Subtask 5 solution here. // You may leave this block unmodified if you are not attempting this // subtask. } }

컴파일 시 표준 에러 (stderr) 메시지

koala.cpp: In function 'int minValue(int, int)':
koala.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#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...