제출 #679419

#제출 시각아이디문제언어결과실행 시간메모리
679419vjudge1Nautilus (BOI19_nautilus)C++17
100 / 100
162 ms716 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define ll long long #define ull unsigned long long #define ed '\n' #define pb push_back #define ii pair<int,int> #define o_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> #define fi first #define se second using namespace __gnu_pbds; using namespace std; bitset<502> d[502], d2[502]; int n, m, k; inline void Do(char c) { bitset<502> tmp[502]; //for(int i = 1; i <= n; ++i) tmp[i] = d[i]; for(int i = 1; i <= n; ++i) { if (c == 'W' || c == '?') tmp[i] |= (d[i] >> 1); if (c == 'E' || c == '?') tmp[i] |= (d[i] << 1); if (c == 'N' || c == '?') tmp[i - 1] |= d[i]; if (c == 'S' || c == '?') tmp[i + 1] |= d[i]; } for(int i = 1; i <= n; ++i) { d[i] = tmp[i] & d2[i]; } } void solve() { cin >> n >> m >> k; for(int i = 1; i <= n; ++i) { for(int j = 1; j <= m; ++j) { char c; cin >> c; if (c == '.') d[i].set(j), d2[i].set(j); } } string s; cin >> s; for(int i = 0; i < k; ++i) { Do(s[i]); // return; } int ans = 0; for(int i = 1; i <= n; ++i) { for(int j = 1; j <= m; ++j) { ans += d[i][j]; } } cout << ans << ed; //cout << ans; } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); if (fopen("cf.inp", "r")) { freopen("cf.inp", "r", stdin); //freopen("cf.inp", "w", stdout); } solve(); return 0; }

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

nautilus.cpp: In function 'int main()':
nautilus.cpp:65:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   65 |         freopen("cf.inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...