답안 #776815

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
776815 2023-07-08T09:57:36 Z vjudge1 Sajam (COCI18_sajam) C++17
45 / 90
11 ms 5332 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long lo; 

#define fi first
#define se second
#define endl "\n"
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo inf = 1000000000;
const lo li = 1005;
const lo mod = 1000000007;

int n,m,a[li][li],k,flag,t,acik[li];
int cev;
string s[li];
vector<int> v;

int main(void){
	fio();
	cin>>n>>k;
	FOR cin>>s[i];
	FOR{
		for(int j=0;j<n;j++){
			if(s[i][j]=='o')a[i][j]=1;
		}
	}
	for(int i=2;i<=n;i++){
		int say=0;
		for(int j=0;j<n;j++){
			if((a[1][j]^a[i][j]))say++;
		}
		cev+=min(say,n-say);
		//~ cout<<i<<" ()() "<<cev<<endl;
	}
	if(cev>k){cout<<"NE\n";return 0;}
	cout<<"DA\n";
	return 0;
	cev=k+1;
	FOR{
		v.clear();
		for(int j=0;j<n;j++){
			if(s[i][j]=='o')v.pb(acik[j]);
			else v.pb(n-acik[j]);
		}
		sort(v.begin(),v.end());
		if(n%2){
			int cur=0;
			for(auto go:v)cur+=abs(go-v[n/2]);
			//~ cout<<cur<<" AAA "<<cev<<endl;
			cev=min(cev,cur);
		}
		else{
			int cur=0;
			for(auto go:v)cur+=abs(go-v[n/2]);
			//~ cout<<cur<<" BBB "<<cev<<endl;
			cev=min(cev,cur);
			cur=0;
			for(auto go:v)cur+=abs(go-v[n/2-1]);
			//~ cout<<cur<<" CCC "<<cev<<endl;
			cev=min(cev,cur);
		}
	}
	if(cev>k)cout<<"NE\n";
	else cout<<"DA\n";
	return 0;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 2 ms 2132 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
4 Correct 4 ms 4692 KB Output is correct
5 Correct 2 ms 2644 KB Output is correct
6 Correct 1 ms 1748 KB Output is correct
7 Correct 3 ms 2516 KB Output is correct
8 Correct 10 ms 4820 KB Output is correct
9 Correct 1 ms 1236 KB Output is correct
10 Correct 10 ms 4948 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 468 KB Output is correct
2 Correct 1 ms 596 KB Output is correct
3 Incorrect 1 ms 596 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 3796 KB Output is correct
2 Correct 4 ms 4308 KB Output is correct
3 Correct 3 ms 3412 KB Output is correct
4 Correct 3 ms 3284 KB Output is correct
5 Correct 5 ms 4692 KB Output is correct
6 Correct 2 ms 2772 KB Output is correct
7 Correct 3 ms 3784 KB Output is correct
8 Correct 3 ms 3924 KB Output is correct
9 Correct 2 ms 2004 KB Output is correct
10 Correct 11 ms 5184 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4564 KB Output is correct
2 Correct 4 ms 4436 KB Output is correct
3 Correct 2 ms 3284 KB Output is correct
4 Correct 3 ms 3796 KB Output is correct
5 Correct 3 ms 3924 KB Output is correct
6 Correct 5 ms 5076 KB Output is correct
7 Correct 2 ms 2388 KB Output is correct
8 Correct 3 ms 3668 KB Output is correct
9 Correct 7 ms 3924 KB Output is correct
10 Correct 11 ms 5204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 3284 KB Output is correct
2 Correct 3 ms 3284 KB Output is correct
3 Incorrect 5 ms 5204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 5332 KB Output is correct
2 Correct 7 ms 5096 KB Output is correct
3 Incorrect 4 ms 4820 KB Output isn't correct
4 Halted 0 ms 0 KB -