제출 #221796

#제출 시각아이디문제언어결과실행 시간메모리
221796patrikpavic2Nautilus (BOI19_nautilus)C++17
100 / 100
182 ms504 KiB
/** * user: ppavic * fname: Patrik * lname: Pavić * task: nautilus * score: 100.0 * date: 2019-05-04 07:21:03.128602 */ #include <cstdio> #include <cstring> #include <cstdlib> #include <algorithm> #include <vector> #include <map> #include <set> #include <deque> #include <bitset> #define X first #define Y second #define PB push_back using namespace std; const int N = 505; bitset < N > cur[N], nw[N], sm[N]; int n, m, l; char s[10 * N]; void move_N(){ for(int i = 0;i < n - 1;i++){ nw[i] |= cur[i + 1]; } } void move_S(){ for(int i = 1;i < n;i++){ nw[i] |= cur[i - 1]; } } void move_W(){ for(int i = 0;i < n ;i++){ nw[i] |= (cur[i] >> 1); } } void move_E(){ for(int i = 0;i < n ;i++){ nw[i] |= (cur[i] << 1); } } void update(){ for(int i = 0;i < n;i++) cur[i] = nw[i] & sm[i]; for(int i = 0;i < n;i++) nw[i].reset(); } void print(){ printf("\n"); for(int i = 0;i < n;i++){ for(int j = 0;j < m;j++){ printf("%d", (int)cur[i][j]); } printf("\n"); } printf("\n"); } int main(){ scanf("%d%d%d", &n, &m, &l); for(int i = 0;i < n;i++){ for(int j = 0;j < m;j++){ char c; scanf(" %c", &c); if(c == '.') sm[i][j] = 1; } cur[i] = sm[i]; } for(int i = 0;i < l;i++){ char c; scanf(" %c", &c); if(c == 'N' || c == '?') move_N(); if(c == 'S' || c == '?') move_S(); if(c == 'E' || c == '?') move_E(); if(c == 'W' || c == '?') move_W(); update(); //print(); } int sol = 0; for(int i = 0;i < n;i++){ sol += cur[i].count(); } printf("%d\n", sol); return 0; }

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

nautilus.cpp: In function 'int main()':
nautilus.cpp:74:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d%d", &n, &m, &l);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~
nautilus.cpp:77:26: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             char c; scanf(" %c", &c);
                     ~~~~~^~~~~~~~~~~
nautilus.cpp:83:22: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         char c; scanf(" %c", &c);
                 ~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...