Submission #1275477


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

int M, N;
int a[110][110];

int main(void){
	cin >> M >> N;
	rep(i, M)rep(j, N) cin >> a[i][j];
	int ans = 0;
	rep(i, M){
		int l = 0, r = N - 1;
		if(i != 0)rep(j, N) a[i][j] ^= 1;

		while(r - l >= 1){
			// printf("l %d r %d\n", l, r);
			if(a[i][l] == 1 && a[i][r] == 1){
				a[i][++l] ^= 1, ans++;
			}else if(a[i][l] == 1){
				a[i][++l] ^= 1, ans++;
			}else if(a[i][r] == 1){
				a[i][--r] ^= 1, ans++;
			}else{
				a[i][++l] ^= 1;
			}
		}
		ans += a[i][l];
		// printf("t %d\n", ans);
	}
	printf("%d\n", ans);
}

Submission Info

Submission Time
Task C - チョコレート
User mmxsrup
Language C++14 (GCC 5.4.1)
Score 250
Code Size 1248 Byte
Status AC
Exec Time 3 ms
Memory 256 KB

Judge Result

Set Name All
Score / Max Score 250 / 250
Status
AC × 76
Set Name Test Cases
All 00_min_00.txt, 00_min_01.txt, 00_teuchi_01.txt, 00_teuchi_02.txt, 01_or_12.txt, 01_or_13.txt, 01_or_14.txt, 01_or_15.txt, 01_or_16.txt, 01_or_17.txt, 01_or_18.txt, 01_or_19.txt, 01_or_20.txt, 01_or_21.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt, 01_random_23.txt, 01_random_24.txt, 01_random_25.txt, 01_random_26.txt, 01_random_27.txt, 01_random_28.txt, 01_random_29.txt, 01_random_30.txt, 01_random_31.txt, 02_oc_22.txt, 02_oc_23.txt, 02_oc_24.txt, 02_oc_25.txt, 02_oc_26.txt, 02_oc_27.txt, 02_oc_28.txt, 02_oc_29.txt, 02_oc_30.txt, 02_oc_31.txt, 03_random_02.txt, 03_random_03.txt, 03_random_04.txt, 03_random_05.txt, 03_random_06.txt, 03_random_07.txt, 03_random_08.txt, 03_random_09.txt, 03_random_10.txt, 03_random_11.txt, 10_asi_24.txt, 10_random_00.txt, 10_random_01.txt, 10_random_02.txt, 10_random_03.txt, 10_random_04.txt, 10_random_05.txt, 10_random_06.txt, 10_random_07.txt, 10_random_08.txt
Case Name Status Exec Time Memory
00_min_00.txt AC 1 ms 256 KB
00_min_01.txt AC 1 ms 256 KB
00_teuchi_01.txt AC 1 ms 256 KB
00_teuchi_02.txt AC 1 ms 256 KB
01_or_12.txt AC 1 ms 256 KB
01_or_13.txt AC 1 ms 256 KB
01_or_14.txt AC 1 ms 256 KB
01_or_15.txt AC 1 ms 256 KB
01_or_16.txt AC 1 ms 256 KB
01_or_17.txt AC 1 ms 256 KB
01_or_18.txt AC 1 ms 256 KB
01_or_19.txt AC 1 ms 256 KB
01_or_20.txt AC 1 ms 256 KB
01_or_21.txt AC 1 ms 256 KB
01_random_00.txt AC 1 ms 256 KB
01_random_01.txt AC 1 ms 256 KB
01_random_02.txt AC 3 ms 256 KB
01_random_03.txt AC 3 ms 256 KB
01_random_04.txt AC 3 ms 256 KB
01_random_05.txt AC 3 ms 256 KB
01_random_06.txt AC 3 ms 256 KB
01_random_07.txt AC 3 ms 256 KB
01_random_08.txt AC 3 ms 256 KB
01_random_09.txt AC 3 ms 256 KB
01_random_10.txt AC 3 ms 256 KB
01_random_11.txt AC 3 ms 256 KB
01_random_12.txt AC 1 ms 256 KB
01_random_13.txt AC 1 ms 256 KB
01_random_14.txt AC 1 ms 256 KB
01_random_15.txt AC 1 ms 256 KB
01_random_16.txt AC 1 ms 256 KB
01_random_17.txt AC 1 ms 256 KB
01_random_18.txt AC 1 ms 256 KB
01_random_19.txt AC 1 ms 256 KB
01_random_20.txt AC 1 ms 256 KB
01_random_21.txt AC 1 ms 256 KB
01_random_22.txt AC 1 ms 256 KB
01_random_23.txt AC 1 ms 256 KB
01_random_24.txt AC 1 ms 256 KB
01_random_25.txt AC 1 ms 256 KB
01_random_26.txt AC 1 ms 256 KB
01_random_27.txt AC 1 ms 256 KB
01_random_28.txt AC 1 ms 256 KB
01_random_29.txt AC 1 ms 256 KB
01_random_30.txt AC 1 ms 256 KB
01_random_31.txt AC 1 ms 256 KB
02_oc_22.txt AC 1 ms 256 KB
02_oc_23.txt AC 1 ms 256 KB
02_oc_24.txt AC 1 ms 256 KB
02_oc_25.txt AC 1 ms 256 KB
02_oc_26.txt AC 1 ms 256 KB
02_oc_27.txt AC 1 ms 256 KB
02_oc_28.txt AC 1 ms 256 KB
02_oc_29.txt AC 1 ms 256 KB
02_oc_30.txt AC 1 ms 256 KB
02_oc_31.txt AC 1 ms 256 KB
03_random_02.txt AC 3 ms 256 KB
03_random_03.txt AC 3 ms 256 KB
03_random_04.txt AC 3 ms 256 KB
03_random_05.txt AC 3 ms 256 KB
03_random_06.txt AC 3 ms 256 KB
03_random_07.txt AC 3 ms 256 KB
03_random_08.txt AC 3 ms 256 KB
03_random_09.txt AC 3 ms 256 KB
03_random_10.txt AC 3 ms 256 KB
03_random_11.txt AC 3 ms 256 KB
10_asi_24.txt AC 3 ms 256 KB
10_random_00.txt AC 1 ms 256 KB
10_random_01.txt AC 3 ms 256 KB
10_random_02.txt AC 1 ms 256 KB
10_random_03.txt AC 1 ms 256 KB
10_random_04.txt AC 1 ms 256 KB
10_random_05.txt AC 1 ms 256 KB
10_random_06.txt AC 1 ms 256 KB
10_random_07.txt AC 1 ms 256 KB
10_random_08.txt AC 1 ms 256 KB