Submission #1194915

#TimeUsernameProblemLanguageResultExecution timeMemory
1194915Mousa_AboubakerPaint By Numbers (IOI16_paint)C++20
10 / 100
194 ms424 KiB
#include "paint.h" #include <bits/stdc++.h> using namespace std; string solve_puzzle(string s, vector<int> c) { // let's try to generate each valid one for each c_i // let's solve the second subtask for now vector<string> x; int n = s.size(); for(int i = 0; i < (1 << n); i++) { string y; for(int j = 0; j < n; j++) y.push_back(((i >> j) & 1) ? 'X' : '_'); vector<int> d; for(int j = 0; j < n; j++) { if(y[j] == '_') continue; int k = j; while(k < n and y[k] == y[j]) k++; d.push_back(k - j); j = k - 1; } if(d == c) x.push_back(y); } string res = x[0]; for(auto i: x) { for(int j = 0; j < n; j++) { if(res[j] == '?') continue; if(res[j] != i[j]) res[j] = '?'; } } return res; }

Compilation message (stderr)

paint.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
paint_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
#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...