Submission #776830

# Submission time Handle Problem Language Result Execution time Memory
776830 2023-07-08T10:07:03 Z vjudge1 Sajam (COCI18_sajam) C++17
45 / 90
835 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];
	//~ if(k>(n+1)/2){cout<<"DA\n";return 0;}
	FOR{
		for(int j=0;j<n;j++){
			if(s[i][j]=='o')a[i][j]=1;
		}
	}
	int mn=0;
	for(int ii=1;ii<=n;ii++){
		cev=0;
		for(int i=2;i<=n;i++){
			if(i==ii)continue;
			int say=0;
			for(int j=0;j<n;j++){
				if((a[ii][j]^a[i][j]))say++;
			}
			cev+=min(say,n-say);
			//~ cout<<i<<" ()() "<<cev<<endl;
		}
		if(ii==1)mn=cev;
		else mn=min(mn,cev);
	}
	if(mn>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;
}

# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 66 ms 2132 KB Output is correct
3 Correct 118 ms 2644 KB Output is correct
4 Correct 644 ms 4784 KB Output is correct
5 Correct 121 ms 2684 KB Output is correct
6 Correct 31 ms 1724 KB Output is correct
7 Correct 106 ms 2556 KB Output is correct
8 Correct 671 ms 4904 KB Output is correct
9 Correct 12 ms 1236 KB Output is correct
10 Correct 698 ms 4964 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 1 ms 596 KB Output is correct
3 Incorrect 1 ms 724 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 359 ms 3884 KB Output is correct
2 Correct 489 ms 4336 KB Output is correct
3 Correct 273 ms 3500 KB Output is correct
4 Correct 218 ms 3284 KB Output is correct
5 Correct 621 ms 4740 KB Output is correct
6 Correct 133 ms 2772 KB Output is correct
7 Correct 344 ms 3840 KB Output is correct
8 Correct 391 ms 4016 KB Output is correct
9 Correct 57 ms 2092 KB Output is correct
10 Correct 818 ms 5268 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 555 ms 4540 KB Output is correct
2 Correct 531 ms 4492 KB Output is correct
3 Correct 233 ms 3320 KB Output is correct
4 Correct 336 ms 3796 KB Output is correct
5 Correct 371 ms 4044 KB Output is correct
6 Correct 760 ms 5112 KB Output is correct
7 Correct 92 ms 2388 KB Output is correct
8 Correct 314 ms 3720 KB Output is correct
9 Correct 380 ms 3924 KB Output is correct
10 Correct 820 ms 5264 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 231 ms 3332 KB Output is correct
2 Correct 252 ms 3352 KB Output is correct
3 Incorrect 811 ms 5224 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 835 ms 5332 KB Output is correct
2 Correct 771 ms 5164 KB Output is correct
3 Incorrect 675 ms 4924 KB Output isn't correct
4 Halted 0 ms 0 KB -