제출 #605659

#제출 시각아이디문제언어결과실행 시간메모리
605659gonzakia29Paint By Numbers (IOI16_paint)C++17
0 / 100
1 ms212 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))){ for (int i = 0; i < sizes; ++i){ if ((bitmask>>i)&1){ cout << "X"; } else{ cout << "-"; } } cout << endl; salida = (salida&bitmask); salida2 = (salida2|bitmask); } } for (int i = 0; i < sizes; ++i){ if ((salida>>i)&1){ cout << "X"; } else if (!((salida2>>i)&1)){ cout << "_"; } else{ cout << "?"; } } cout << endl; return ""; }
#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...