제출 #934705

#제출 시각아이디문제언어결과실행 시간메모리
934705MackerPaint By Numbers (IOI16_paint)C++14
80 / 100
2064 ms1080 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define all(v) v.begin(), v.end() #define FOR(i, n) for (int i = 0; i < n; i++) bool can(string s, vector<int> c){ int n = s.size(); int k = c.size(); vector<vector<int>> dp(n + 1, vector<int>(k + 1)); dp[0][0] = 1; FOR(i, n + 1) FOR(j, k + 1){ if(!dp[i][j]) continue; if(i != n && s[i] != 'X') dp[i + 1][j] = 1; if(dp[i][j] != 2 && j != k && i + c[j] <= n ){ bool f = 0; FOR(l, c[j]){ f = max(f, s[l + i] == '_'); } if(!f) dp[i + c[j]][j + 1] = 2; } } return dp[n][k] != 0; } std::string solve_puzzle(std::string s, std::vector<int> c) { FOR(i, s.size()){ if(s[i] != '.') continue; s[i] = 'X'; if(!can(s, c)) { s[i] = '_'; continue; } s[i] = '_'; if(!can(s, c)){ s[i] = 'X'; continue; } s[i] = '?'; } return s; }

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

paint.cpp: In function 'std::string solve_puzzle(std::string, std::vector<int>)':
paint.cpp:6:37: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    6 | #define FOR(i, n) for (int i = 0; i < n; i++)
......
   29 |     FOR(i, s.size()){
      |         ~~~~~~~~~~~                  
paint.cpp:29:5: note: in expansion of macro 'FOR'
   29 |     FOR(i, s.size()){
      |     ^~~
#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...