제출 #290086

#제출 시각아이디문제언어결과실행 시간메모리
290086shayan_pPaint By Numbers (IOI16_paint)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #include "paint.h" #define F first #define S second #define PB push_back #define sz(s) (int(s.size())) #define bit(n, k) (((n)>>(k)) & 1) using namespace std; typedef pair<int, int> pii; typedef long long ll; const int maxn = 110, mod = 1e9 + 7, inf = 1e9 + 10; bool dp[maxn][maxn], any[maxn][maxn]; bool solve(string &s, vector<int> &c){ for(int i = 1; i <= sz(s); i++){ any[i][i] = s[i-1] == '_'; for(int j = i+1; j <= sz(s); j++){ any[i][j]= any[i][j-1] || s[j-1] == '_'; } } dp[0][0] = 1; for(int i = 0; i <= sz(c); i++){ for(int j = 1; j <= sz(s); j++){ dp[i][j] = 0; if(s[j-1] != 'X') dp[i][j]|= dp[i][j-1]; if(i > 0){ if(j > c[i-1]) dp[i][j]|= !any[j-c[i-1]+1][j] && s[j-1-c[i-1]] != 'X' && dp[i-1][j-c[i-1]-1]; if(j == c[i-1]) dp[i][j]|= !any[1][j] && i == 1; } } } return dp[sz(c)][sz(s)]; } string solve_puzzle(string s, vector<int> c){ string ans = s; for(int i = 0; i < sz(s); i++){ if(s[i] == '.'){ s[i] = 'X'; bool A = solve(s, c); s[i] = '_'; bool B = solve(s, c); if(A && B) ans[i] = '?'; else if(A) ans[i] = 'X'; else if(B) ans[i] = '_'; else assert(0); s[i] = '.'; } } return ans; }

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

paint.cpp: In function 'bool solve(std::string&, std::vector<int>&)':
paint.cpp:21:2: error: reference to 'any' is ambiguous
   21 |  any[i][i] = s[i-1] == '_';
      |  ^~~
In file included from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:126,
                 from paint.cpp:1:
/usr/include/c++/9/any:77:9: note: candidates are: 'class std::any'
   77 |   class any
      |         ^~~
paint.cpp:17:22: note:                 'bool any [110][110]'
   17 | bool dp[maxn][maxn], any[maxn][maxn];
      |                      ^~~
paint.cpp:23:6: error: reference to 'any' is ambiguous
   23 |      any[i][j]= any[i][j-1] || s[j-1] == '_';
      |      ^~~
In file included from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:126,
                 from paint.cpp:1:
/usr/include/c++/9/any:77:9: note: candidates are: 'class std::any'
   77 |   class any
      |         ^~~
paint.cpp:17:22: note:                 'bool any [110][110]'
   17 | bool dp[maxn][maxn], any[maxn][maxn];
      |                      ^~~
paint.cpp:23:17: error: reference to 'any' is ambiguous
   23 |      any[i][j]= any[i][j-1] || s[j-1] == '_';
      |                 ^~~
In file included from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:126,
                 from paint.cpp:1:
/usr/include/c++/9/any:77:9: note: candidates are: 'class std::any'
   77 |   class any
      |         ^~~
paint.cpp:17:22: note:                 'bool any [110][110]'
   17 | bool dp[maxn][maxn], any[maxn][maxn];
      |                      ^~~
paint.cpp:34:19: error: reference to 'any' is ambiguous
   34 |       dp[i][j]|= !any[j-c[i-1]+1][j] && s[j-1-c[i-1]] != 'X' && dp[i-1][j-c[i-1]-1];
      |                   ^~~
In file included from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:126,
                 from paint.cpp:1:
/usr/include/c++/9/any:77:9: note: candidates are: 'class std::any'
   77 |   class any
      |         ^~~
paint.cpp:17:22: note:                 'bool any [110][110]'
   17 | bool dp[maxn][maxn], any[maxn][maxn];
      |                      ^~~
paint.cpp:36:19: error: reference to 'any' is ambiguous
   36 |       dp[i][j]|= !any[1][j] && i == 1;
      |                   ^~~
In file included from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:126,
                 from paint.cpp:1:
/usr/include/c++/9/any:77:9: note: candidates are: 'class std::any'
   77 |   class any
      |         ^~~
paint.cpp:17:22: note:                 'bool any [110][110]'
   17 | bool dp[maxn][maxn], any[maxn][maxn];
      |                      ^~~