답안 #777465

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
777465 2023-07-09T09:19:17 Z vjudge1 Sajam (COCI18_sajam) C++17
0 / 90
21 ms 4208 KB
#include<bits/stdc++.h>
using namespace std;
#define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);
//#define endl "\n"
#define ll long long
#define pb push_back
#define N 1005
#define f first
#define s second
#define M 17
int dp[N];
int main(){
	int n,k;cin>>n>>k;
	int ilk[n];
	string str;cin>>str;
	for(int i=0;i<n;i++){
		ilk[i]=(str[i]=='o');
	}
	int arr[n-1][n];
	for(int i=0;i<n-1;i++){
		cin>>str;
		for(int j=0;j<n;j++){
			int a=(str[j]=='o');
			arr[i][j]=ilk[j]^a;
		}
	}
	ll int cev=0;
	for(int i=0;i<n-1;i++){
		for(int j=0;j<n;j++){
			dp[i]+=arr[i][j];
		}
		if(dp[i]<=n-dp[i])cev+=dp[i];
		else cev+=(n-dp[i]);
	}
	if(cev<=k){
		cout<<"DA"<<endl;
		return 0;
	}


	for(int i=0;i<n;i++){
		int fark=0;
		for(int j=0;j<n-1;j++){
			if(dp[j]==n-dp[j]){
				fark--;continue;
			}
			if(arr[j][i]){
				if(dp[j]>n-dp[j])fark--;
				else fark++;
				continue;
			}
			if(dp[j]>n-dp[j])fark++;
			else fark--;
		}
		if(fark<0){
			cev+=fark;
			k--;
		}

	}
	if(k)cout<<"DA"<<endl;
	else cout<<"NE"<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 3 ms 980 KB Output is correct
3 Correct 4 ms 1236 KB Output is correct
4 Correct 13 ms 3412 KB Output is correct
5 Correct 5 ms 1236 KB Output is correct
6 Correct 2 ms 596 KB Output is correct
7 Incorrect 5 ms 1252 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Incorrect 1 ms 308 KB Output isn't correct
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 2388 KB Output is correct
2 Correct 14 ms 2996 KB Output is correct
3 Correct 7 ms 2004 KB Output is correct
4 Correct 7 ms 1876 KB Output is correct
5 Correct 17 ms 3472 KB Output is correct
6 Incorrect 5 ms 1364 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 3156 KB Output is correct
2 Correct 13 ms 3160 KB Output is correct
3 Correct 7 ms 1936 KB Output is correct
4 Correct 9 ms 2400 KB Output is correct
5 Correct 9 ms 2516 KB Output is correct
6 Incorrect 21 ms 3924 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 1876 KB Output is correct
2 Correct 7 ms 1876 KB Output is correct
3 Correct 17 ms 4088 KB Output is correct
4 Correct 5 ms 1364 KB Output is correct
5 Correct 8 ms 1876 KB Output is correct
6 Correct 16 ms 3924 KB Output is correct
7 Correct 6 ms 1628 KB Output is correct
8 Correct 6 ms 1748 KB Output is correct
9 Incorrect 8 ms 1852 KB Output isn't correct
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 4208 KB Output is correct
2 Correct 16 ms 4012 KB Output is correct
3 Correct 16 ms 3688 KB Output is correct
4 Correct 9 ms 2364 KB Output is correct
5 Correct 9 ms 2388 KB Output is correct
6 Correct 12 ms 2516 KB Output is correct
7 Correct 6 ms 1620 KB Output is correct
8 Correct 15 ms 3796 KB Output is correct
9 Incorrect 14 ms 2260 KB Output isn't correct
10 Halted 0 ms 0 KB -