제출 #605671

#제출 시각아이디문제언어결과실행 시간메모리
605671gonzakia29Paint By Numbers (IOI16_paint)C++17
10 / 100
20 ms340 KiB
#include "paint.h" #include <iostream> #include <cstdlib> using namespace std; string solve_puzzle(string s, vector<int> c) { int k = c.size(); int sizes = s.size(); int salida = (1<<sizes)-1, salida2 = 0; for (int bitmask = 0; bitmask < (1<<sizes); ++bitmask){ int counter = 0, counter2 = 1; int flag = 0; for (int i = 0; i < sizes; ++i){ if ((bitmask>>i)&1){ if (counter2 > k){ flag = 2; break; } counter++; if (counter == c[counter2-1]){ flag = 1; } else if (counter > c[counter2-1]){ flag = 2; break; } } else{ if (counter != 0 && flag != 1){ flag = 2; break; } counter = 0; if (flag == 1){ counter2++; flag = 0; } } } if (((counter2 == k+1)&&(flag == 0))||((counter2 == k)&&(flag == 1))){ salida = (salida&bitmask); salida2 = (salida2|bitmask); } } string ANS = ""; for (int i = 0; i < sizes; ++i){ if ((salida>>i)&1){ ANS += "X"; } else if (!((salida2>>i)&1)){ ANS += "_"; } else{ ANS += "?"; } } return ANS; }
#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...