Submission #845720

# Submission time Handle Problem Language Result Execution time Memory
845720 2023-09-06T15:05:07 Z vjudge1 Skandi (COCI20_skandi) C++17
9 / 110
1 ms 348 KB
#include <bits/stdc++.h>
#define endl "\n"
#define pb push_back
#define int long long
using namespace std;

const int inf = 2e18 + 5;
const int N = 5e3 + 5;
const int mod = 998244353;

int fpow(int a, int b){
 if(b == 0) return 1;

 int p = 1;
 while(b){
    if(b&1) p = p*a;

    b = b/2;
    a = a*a;
 }

 return p;
}

int32_t main(){
  //freopen("in.txt","r", stdin);
  int n, m;
  cin>>n>>m;

  vector<vector<int> > a(n, vector<int>(m));
  for(int i = 0; i < n; i++){
    for(int j = 0; j < m; j++){
        char c;
        cin>>c;
        a[i][j] = c - '0';
    }
  }

  int ans1 = 0, ans2 = 0;
  for(int i = 0; i < n; i++){
    bool mask = 0;
    for(int j = 0; j < m; j++){
        if(a[i][j] == 0 && !mask){
            mask = 1;
            ans1++;
        }
        else if(a[i][j] == 1 && mask){
            mask = 0;
        }
    }
  }

  for(int i = 0; i < m; i++){
    bool mask = 0;
    for(int j = 0; j < n; j++){
        if(a[j][i] == 0 && !mask){
            mask = 1;
            ans2++;
        }
        else if(a[j][i] == 1 && mask){
            mask = 0;
        }
    }
  }

  cout<<min(ans1, ans2)<<endl;
  return 0;
}
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 344 KB First line is correct, but the reconstruction is not properly formatted.
2 Partially correct 0 ms 348 KB First line is correct, but the reconstruction is not properly formatted.
3 Partially correct 1 ms 344 KB First line is correct, but the reconstruction is not properly formatted.
4 Partially correct 1 ms 344 KB First line is correct, but the reconstruction is not properly formatted.
5 Partially correct 1 ms 344 KB First line is correct, but the reconstruction is not properly formatted.
6 Partially correct 1 ms 348 KB First line is correct, but the reconstruction is not properly formatted.
7 Partially correct 0 ms 344 KB First line is correct, but the reconstruction is not properly formatted.
8 Partially correct 0 ms 344 KB First line is correct, but the reconstruction is not properly formatted.
9 Partially correct 0 ms 344 KB First line is correct, but the reconstruction is not properly formatted.
10 Partially correct 1 ms 344 KB First line is correct, but the reconstruction is not properly formatted.
11 Partially correct 1 ms 348 KB First line is correct, but the reconstruction is not properly formatted.
12 Partially correct 0 ms 344 KB First line is correct, but the reconstruction is not properly formatted.
13 Partially correct 0 ms 348 KB First line is correct, but the reconstruction is not properly formatted.
14 Partially correct 0 ms 348 KB First line is correct, but the reconstruction is not properly formatted.
15 Partially correct 0 ms 348 KB First line is correct, but the reconstruction is not properly formatted.
16 Partially correct 0 ms 348 KB First line is correct, but the reconstruction is not properly formatted.
17 Partially correct 0 ms 344 KB First line is correct, but the reconstruction is not properly formatted.
18 Partially correct 1 ms 344 KB First line is correct, but the reconstruction is not properly formatted.
19 Partially correct 1 ms 344 KB First line is correct, but the reconstruction is not properly formatted.
20 Partially correct 0 ms 348 KB First line is correct, but the reconstruction is not properly formatted.
21 Partially correct 0 ms 344 KB First line is correct, but the reconstruction is not properly formatted.
22 Partially correct 1 ms 344 KB First line is correct, but the reconstruction is not properly formatted.
23 Partially correct 0 ms 344 KB First line is correct, but the reconstruction is not properly formatted.
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 344 KB First line is correct, but the reconstruction is not properly formatted.
2 Incorrect 1 ms 344 KB First line is not correct.
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 344 KB First line is correct, but the reconstruction is not properly formatted.
2 Partially correct 0 ms 348 KB First line is correct, but the reconstruction is not properly formatted.
3 Partially correct 1 ms 344 KB First line is correct, but the reconstruction is not properly formatted.
4 Partially correct 1 ms 344 KB First line is correct, but the reconstruction is not properly formatted.
5 Partially correct 1 ms 344 KB First line is correct, but the reconstruction is not properly formatted.
6 Partially correct 1 ms 348 KB First line is correct, but the reconstruction is not properly formatted.
7 Partially correct 0 ms 344 KB First line is correct, but the reconstruction is not properly formatted.
8 Partially correct 0 ms 344 KB First line is correct, but the reconstruction is not properly formatted.
9 Partially correct 0 ms 344 KB First line is correct, but the reconstruction is not properly formatted.
10 Partially correct 1 ms 344 KB First line is correct, but the reconstruction is not properly formatted.
11 Partially correct 1 ms 348 KB First line is correct, but the reconstruction is not properly formatted.
12 Partially correct 0 ms 344 KB First line is correct, but the reconstruction is not properly formatted.
13 Partially correct 0 ms 348 KB First line is correct, but the reconstruction is not properly formatted.
14 Partially correct 0 ms 348 KB First line is correct, but the reconstruction is not properly formatted.
15 Partially correct 0 ms 348 KB First line is correct, but the reconstruction is not properly formatted.
16 Partially correct 0 ms 348 KB First line is correct, but the reconstruction is not properly formatted.
17 Partially correct 0 ms 344 KB First line is correct, but the reconstruction is not properly formatted.
18 Partially correct 1 ms 344 KB First line is correct, but the reconstruction is not properly formatted.
19 Partially correct 1 ms 344 KB First line is correct, but the reconstruction is not properly formatted.
20 Partially correct 0 ms 348 KB First line is correct, but the reconstruction is not properly formatted.
21 Partially correct 0 ms 344 KB First line is correct, but the reconstruction is not properly formatted.
22 Partially correct 1 ms 344 KB First line is correct, but the reconstruction is not properly formatted.
23 Partially correct 0 ms 344 KB First line is correct, but the reconstruction is not properly formatted.
24 Partially correct 1 ms 344 KB First line is correct, but the reconstruction is not properly formatted.
25 Incorrect 1 ms 344 KB First line is not correct.
26 Halted 0 ms 0 KB -