Submission #123192

#TimeUsernameProblemLanguageResultExecution timeMemory
123192HideoPaint By Numbers (IOI16_paint)C++14
32 / 100
2 ms504 KiB
#include <bits/stdc++.h> #include "paint.h" //#include "grader.cpp" using namespace std; const int N = 2e5 + 7; int a[N], b[N], pr[N], sf[N]; int n; std::string ans; std::string solve_puzzle(std::string s, std::vector<int> c) { n = c.size(); for (int i = 0; i < n; i++){ a[i + 1] = c[i]; pr[i + 1] = pr[i] + c[i] + 1; } if (pr[n] - 1 == s.size()){ int ct = 1; for (int i = 1; i <= s.size(); i++){ if (i == pr[ct]){ ans += '_'; ct++; } else ans += 'X'; } return ans; } for (int i = n; i >= 1; i--) sf[i] = sf[i + 1] + a[i] + 1; for (int i = 1; i <= n; i++){ int r1, l2; r1 = pr[i - 1] + a[i]; l2 = s.size() - sf[i] + 2; for (int j = l2; j <= r1; j++){ b[j] = 1; } } for (int i = 1; i <= s.size(); i++){ if (b[i] == 1) ans += 'X'; else ans += '?'; } return ans; }

Compilation message (stderr)

paint.cpp: In function 'std::__cxx11::string solve_puzzle(std::__cxx11::string, std::vector<int>)':
paint.cpp:20:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (pr[n] - 1 == s.size()){
         ~~~~~~~~~~^~~~~~~~~~~
paint.cpp:22:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int i = 1; i <= s.size(); i++){
                         ~~^~~~~~~~~~~
paint.cpp:43:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 1; i <= s.size(); i++){
                     ~~^~~~~~~~~~~
#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...