Submission #138887

#TimeUsernameProblemLanguageResultExecution timeMemory
138887arthurconmyPaint By Numbers (IOI16_paint)C++14
32 / 100
3 ms380 KiB
#include <bits/stdc++.h> #ifndef ARTHUR_LOCAL #include "paint.h" #endif using namespace std; string solve_puzzle(string S, vector<int> C) { int n = S.size(); int k = C.size(); int c_sum=0; for(auto c:C) c_sum += c; if(c_sum + k - 1 == n) { int i=0; for(auto c:C) { for(int d=1; d<=c; d++) S[i++]='X'; if(i<n) S[i++]='_'; } return S; } for(int i=0; i<n; i++) { int cur = 0; for(int j=0; j<k; j++) { cur += C[j]; if(cur + j > i) { int RHS=0; RHS += c_sum; RHS -= cur; RHS += C[j]; RHS += (k-j)-1; //if(i==2) cout << RHS << endl; if(RHS <= n-i-1) S[i]='?'; else S[i]='X'; break; } } if(S[i]=='.') S[i]='?'; } return S; } #ifdef ARTHUR_LOCAL int main() { cout << solve_puzzle("..........",{3,4}) << endl; } #endif
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...