제출 #860191

#제출 시각아이디문제언어결과실행 시간메모리
860191maks007Valley (BOI19_valley)C++14
0 / 100
1228 ms262144 KiB
#include "bits/stdc++.h" using namespace std; int dp[110][110][110]; signed main () { map <char,char> op; map <char,int> it, jt; op['E'] = 'W'; op['W'] = 'E'; op['S'] = 'N'; op['N'] = 'S'; it['E'] = 0; it['W'] = 0; it['S'] = 1; it['N'] = -1; jt['E'] = 1; jt['W'] = -1; jt['S'] = 0; jt['N'] = 0; int n, m, c; cin >> n >> m >> c; string a[n+1]; for(int i = 1; i <= n; i ++) { cin >> a[i]; a[i] = ' ' + a[i]; } string str; cin >> str; str = ' ' + str; set <pair <int,int>> s; for(int i = 1; i <= n; i ++) { for(int j = 1; j <= m; j ++) s.insert({i, j}); } for(int i = 1; i <= str.size(); i += 1) { vector <pair <int,int>> v; for(auto [posi, posj] : s) { if(a[posi][posj] == '#') { dp[i][posi][posj] = 0; v.push_back({posi, posj}); continue; } if(i == 1) { dp[i][posi][posj]=1; }else { if(str[i-1] == '?') { char ch = 'E'; dp[i][posi][posj] |= dp[i-1][posi+it[ch]][posj+jt[ch]]; ch = 'W'; dp[i][posi][posj] |= dp[i-1][posi+it[ch]][posj+jt[ch]]; ch = 'N'; dp[i][posi][posj] |= dp[i-1][posi+it[ch]][posj+jt[ch]]; ch = 'S'; dp[i][posi][posj] |= dp[i-1][posi+it[ch]][posj+jt[ch]]; }else { char ch = op[str[i-1]]; dp[i][posi][posj] |= dp[i-1][posi+it[ch]][posj+jt[ch]]; } } if(!dp[i][posi][posj]) v.push_back({posi, posj}); } for(auto j : v) s.erase(j); } int ans = 0; for(int i = 1; i <= n; i ++) { for(int j = 1; j <= m; j ++) { ans += (dp[str.size()][i][j]); } } cout << ans; return 0; }

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

valley.cpp: In function 'int main()':
valley.cpp:37:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |  for(int i = 1; i <= str.size(); i += 1) {
      |                 ~~^~~~~~~~~~~~~
valley.cpp:39:12: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   39 |   for(auto [posi, posj] : s) {
      |            ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...