제출 #410722

#제출 시각아이디문제언어결과실행 시간메모리
410722DBPhoenixPaint By Numbers (IOI16_paint)C++17
32 / 100
1 ms304 KiB
#include "paint.h" #include <bits/stdc++.h> using namespace std; string solve_puzzle(string s, vector<int> c) { string out; int n = s.size(); out = s; long long min = 0; long long max = c[0]; for (int i = 1; i < c.size(); i++) max += c[i] + 1; for (int k = 0; k < c.size(); k++) { int i = min; if (k == c.size() - 1) for (int j = min + c[k]; j < n; j++) out[j] = (out[j] == 'X' || out[j] == '?') ? '?' : '_'; for (; i <= n - max; i++) { bool skip = false; for (int j = 0; j < c[k]; j++) if (s[i + j] == '_') skip = true; if (skip) continue; if (i > 0) if (s[i - 1] == '.') out[i - 1] = (out[i - 1] == 'X' || out[i - 1] == '?') ? '?' : '_'; for (int j = 0; j < c[k]; j++) out[i + j] = (out[i + j] == '_' || out[i + j] == '?') ? '?' : 'X'; if (i + c[k] < n) if (s[i + c[k]] == '.') out[i + c[k]] = (out[i + c[k]] == 'X' || out[i + c[k]] == '?') ? '?' : '_'; } if (k == 0) for (int j = 0; j < i - 1; j++) out[j] = (out[j] == 'X' || out[j] == '?') ? '?' : '_'; max -= c[k] + 1; min += c[k] + 1; } return out; }

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

paint.cpp: In function 'std::string solve_puzzle(std::string, std::vector<int>)':
paint.cpp:14:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |     for (int i = 1; i < c.size(); i++) max += c[i] + 1;
      |                     ~~^~~~~~~~~~
paint.cpp:16:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |     for (int k = 0; k < c.size(); k++)
      |                     ~~^~~~~~~~~~
paint.cpp:20:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |         if (k == c.size() - 1)
      |             ~~^~~~~~~~~~~~~~~
#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...