Submission #116335

#TimeUsernameProblemLanguageResultExecution timeMemory
116335AdOjis485Paint By Numbers (IOI16_paint)C++14
32 / 100
14 ms384 KiB
// // main.cpp // paint_by_numbers // // Created by Ema Skottova on 12.06.19. // Copyright © 2019 Ema Skottova. All rights reserved. // #include "paint.h" #include <cstdlib> //#include <iostream> using namespace std; std::string solve_puzzle(std::string s, std::vector<int> c) { int n = s.size(); int k = c.size(); vector<int> state(n); int sum = c[0]; int j = 0; for(int i = 0; i < n; i ++){ if(j < k && c[j] > 0){ c[j] --; state[i] = 1; } else{ state[i] = 0; j ++; if(j < k){ sum += c[j]; } } } sum += k - 1; if(sum < n){ int x = n - sum; int w = -1; for(int i = 0; i < n; i ++){ if(state[i] == 0){ w = i; } if(state[i] != 1 or i - w <= x){ state[i] = 2; } else{ state[i] = 1; } } } for(int i = 0; i < n; i ++){ if(state[i] == 0){ s[i] = '_'; } else if(state[i] == 1){ s[i] = 'X'; } else{ s[i] = '?'; } } return s; } /* int main(){ string s; int k; vector<int> c; cin >> s >> k; for(int i = 0; i < k; i ++){ int x; cin >> x; c.push_back(x); } cout << solve_puzzle(s, c); return 0; }*/
#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...