답안 #520867

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
520867 2022-01-31T10:22:32 Z YeoBL Telefoni (COCI17_telefoni) C++17
16 / 80
18 ms 976 KB
#include <bits/stdc++.h>
using namespace std;
const int MOD=1e9+7;
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")
//#pragma GCC optimize("Ofast") //only when desperate
//#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") // only when desperate

#define pb emplace_back
#define mp make_pair
#define fi first
#define se second
#define pi pair<int,int>
#define FOR(a,b,i) for (int i=a;i!=b;a>b?i--:i++)
#define F0R(a,i) FOR(0,a,i)
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define allr(a) (a), (a)+sizeof(a)/sizeof(a[0]) 
#define sq(a) (a)*(a)
#define tri(x) (x)*((x)+1)/2
#define ll long long 
#define endl '\n'
#define INF 1e9+5
#define LINF 1e18+5
#define read(x) cin >> x;
#define read2(x,y) cin >> x >> y;
#define read3(x,y,z) cin >> x >> y >> z;
#define read4(w,x,y,z) cin >> w >> x >> y >> z;
#define show(x) cerr << #x << " is " << x << endl;
#define show2(x,y) cerr << #x << " is " << x << " " << #y << " is " << y << endl;
#define show3(x,y,z) cerr << #x << " is " << x << " " << #y << " is " << y << " " << #z << " is " << z << endl;
#define show4(w,x,y,z) cerr << #w << " is " << w << " " << #x << " is " << x << " " << #y << " is " << y << " " << #z << " is " << z << endl;
#define fastio ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define YES cout << "YES\n";
#define NO cout << "NO\n";
mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
void solve(){
	int n, k, cnt=1, ans=0; read2(n,k);
	bool arr[n], flag=false;
	for (int i=0;i<n;i++){
		read(arr[i]);
		flag|=arr[i];
		if (!arr[i]) cnt++;
		if (flag and cnt>k){
			cnt = 1;
			ans++;
		}
	}
	cout << ans << '\n';
}
int32_t main(){
	fastio;
	int tc=1; //cin >> tc;
	while (tc--) solve();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 0 ms 204 KB Output isn't correct
4 Incorrect 0 ms 204 KB Output isn't correct
5 Incorrect 1 ms 320 KB Output isn't correct
6 Incorrect 1 ms 204 KB Output isn't correct
7 Incorrect 1 ms 316 KB Output isn't correct
8 Incorrect 18 ms 960 KB Output isn't correct
9 Incorrect 18 ms 976 KB Output isn't correct
10 Incorrect 17 ms 960 KB Output isn't correct