제출 #773420

#제출 시각아이디문제언어결과실행 시간메모리
773420JomnoiPaint By Numbers (IOI16_paint)C++17
32 / 100
1 ms212 KiB
#include <bits/stdc++.h> #include "paint.h" using namespace std; const int MAX_N = 2e5 + 5; int qs[MAX_N]; string ans; string solve_puzzle(string s, vector <int> c) { int N = s.size(), k = c.size(); for (int i = 0; i < k; i++) { for (int j = 0; j < c[i]; j++) ans.push_back('X'); if (i < k - 1) ans.push_back('_'); } while (ans.size() < N) ans.push_back('_'); for (int i = 1; i <= k; i++) qs[i] = qs[i - 1] + c[i - 1]; for (int i = 1; i <= k; i++) { int l = qs[i - 1] + i; int r = N - (qs[k] - qs[i]) - (k - i); for (int j = l; j < r - c[i - 1] + 1; j++) ans[j - 1] = '?'; for (int j = l + c[i - 1]; j <= r; j++) ans[j - 1] = '?'; // for (int j = r - c[i - 1] + 1; j <= l + c[i - 1] - 1; j++) ans[j - 1] = 'X'; } return ans; }

컴파일 시 표준 에러 (stderr) 메시지

paint.cpp: In function 'std::string solve_puzzle(std::string, std::vector<int>)':
paint.cpp:16:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   16 |     while (ans.size() < N) ans.push_back('_');
      |            ~~~~~~~~~~~^~~
#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...