Submission #789646

#TimeUsernameProblemLanguageResultExecution timeMemory
789646AkramElOmraniPaint By Numbers (IOI16_paint)C++17
0 / 100
1 ms308 KiB
#pragma once #include <bits/stdc++.h> #include <string> #include <vector> using namespace std; std::string solve_puzzle(std::string s, std::vector<int> c) { int n = s.length(); int m = c.size(); string ans(n, '?'); int sm = accumulate(c.begin(), c.end(), 0) + c.size() - 1; if(sm == n) { int s = 0; for(int i = 0; i < m; ++i) { while(c[i]) { c[i]--; ans[s++] = 'X'; } if(s != n) ans[s++] = '_'; } cout << ans << '\n'; return ans; } for(int i = 0; i < n; ++i) { int before = 0; int j = 0; while(j < m && before + c[j] <= i) { before += c[j++]; before++; } before = i + 1; while(j < m && before + c[j] <= n) { before += c[j++]; before++; } if(j != m) { ans[i] = 'X'; } } return ans; }

Compilation message (stderr)

paint.cpp: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...