Submission #776784

# Submission time Handle Problem Language Result Execution time Memory
776784 2023-07-08T09:13:53 Z vjudge1 Sajam (COCI18_sajam) C++17
15 / 90
37 ms 2296 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],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')acik[j]++;
		}
	}
	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 340 KB Output is correct
2 Correct 2 ms 640 KB Output is correct
3 Correct 3 ms 852 KB Output is correct
4 Correct 10 ms 2004 KB Output is correct
5 Correct 4 ms 884 KB Output is correct
6 Correct 2 ms 468 KB Output is correct
7 Correct 11 ms 864 KB Output is correct
8 Correct 37 ms 2004 KB Output is correct
9 Correct 3 ms 468 KB Output is correct
10 Correct 37 ms 2132 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Incorrect 1 ms 352 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 1520 KB Output is correct
2 Correct 10 ms 1748 KB Output is correct
3 Correct 6 ms 1236 KB Output is correct
4 Correct 6 ms 1136 KB Output is correct
5 Correct 11 ms 2004 KB Output is correct
6 Incorrect 4 ms 880 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 13 ms 1876 KB Output is correct
2 Correct 10 ms 1860 KB Output is correct
3 Correct 6 ms 1096 KB Output is correct
4 Correct 7 ms 1400 KB Output is correct
5 Correct 7 ms 1436 KB Output is correct
6 Incorrect 12 ms 2140 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 1212 KB Output is correct
2 Correct 9 ms 1236 KB Output is correct
3 Correct 13 ms 2236 KB Output is correct
4 Correct 4 ms 852 KB Output is correct
5 Correct 6 ms 1236 KB Output is correct
6 Incorrect 17 ms 2164 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 17 ms 2296 KB Output is correct
2 Correct 16 ms 2276 KB Output is correct
3 Correct 13 ms 2128 KB Output is correct
4 Correct 7 ms 1392 KB Output is correct
5 Correct 7 ms 1364 KB Output is correct
6 Incorrect 9 ms 1492 KB Output isn't correct
7 Halted 0 ms 0 KB -