제출 #855363

#제출 시각아이디문제언어결과실행 시간메모리
855363AlfraganusBomb (IZhO17_bomb)C++17
0 / 100
63 ms131072 KiB
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define ll long long #define fs first #define ss second #define all(a) a.begin(), a.end() #define print(a) \ for (auto x : a) \ cout << x << ' '; \ cout << endl; #define printmp(a) \ for (auto x : a) \ cout << x.fs << ' ' << x.ss << endl; void solve(){ int n, m; cin >> n >> m; vector<vector<char>> a(n, vector<char> (m)); for(int i = 0; i < n; i ++){ for(int j = 0; j < m; j ++){ cin >> a[i][j]; } } if(n == 1){ int r = 0, ans = 0, l = 0; while(r < m){ while(r < m and a[0][r] == '0') r ++; l = r; while(r < m and a[0][r] == '1') r ++; ans += (r != l); } cout << ans; } else if(m == 1){ int r = 0, ans = 0, l = 0; while (r < n) { while (r < n and a[r][0] == '0') r++; l = r; while (r < n and a[r][0] == '1') r++; ans += (r != l); } cout << ans; } else{ cout << 3 << endl; } } signed main(){ ios::sync_with_stdio(0); cin.tie(0); freopen("bomb.in", "r", stdin); freopen("bomb.out", "w", stdout); int t = 1; // cin >> t; while(t --){ solve(); cout << endl; } }

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

bomb.cpp: In function 'int main()':
bomb.cpp:60:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   60 |     freopen("bomb.in", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
bomb.cpp:61:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   61 |     freopen("bomb.out", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...