Submission #777492

# Submission time Handle Problem Language Result Execution time Memory
777492 2023-07-09T09:38:28 Z vjudge1 Sajam (COCI18_sajam) C++17
90 / 90
21 ms 4560 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 arr[n][n];
	for(int i=0;i<n;i++){
		string str;cin>>str;
		for(int j=0;j<n;j++){
			arr[i][j]=(str[j]=='o');
		}
	}
	for(int uwu=0;uwu<2;uwu++){
		for(int i=0;i<n;i++){
			int bir=0;
			for(int j=0;j<n;j++){
				bir+=arr[i][j];
			}
			if(bir>n-bir){
				for(int j=0;j<n;j++){
					arr[i][j]^=1;
				}
			}
		}
		for(int i=0;i<n;i++){
			int bir=0;
			for(int j=0;j<n;j++){
				bir+=arr[j][i];
			}
			if(bir>n-bir){
				for(int j=0;j<n;j++){
					arr[j][i]^=1;
				}
			}
		}
	}
	int bir=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			bir+=arr[i][j];
		}
	}
	if(bir>n*n-bir)bir=n*n-bir;
	if(bir<=k)cout<<"DA"<<endl;
	else cout<<"NE"<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 5 ms 980 KB Output is correct
3 Correct 5 ms 1328 KB Output is correct
4 Correct 15 ms 3412 KB Output is correct
5 Correct 6 ms 1236 KB Output is correct
6 Correct 3 ms 596 KB Output is correct
7 Correct 5 ms 1236 KB Output is correct
8 Correct 19 ms 4392 KB Output is correct
9 Correct 1 ms 468 KB Output is correct
10 Correct 17 ms 4404 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 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 300 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 2496 KB Output is correct
2 Correct 14 ms 2996 KB Output is correct
3 Correct 12 ms 2108 KB Output is correct
4 Correct 9 ms 1876 KB Output is correct
5 Correct 18 ms 3464 KB Output is correct
6 Correct 6 ms 1364 KB Output is correct
7 Correct 12 ms 2656 KB Output is correct
8 Correct 13 ms 2800 KB Output is correct
9 Correct 3 ms 980 KB Output is correct
10 Correct 20 ms 4500 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 3156 KB Output is correct
2 Correct 18 ms 3160 KB Output is correct
3 Correct 8 ms 1876 KB Output is correct
4 Correct 11 ms 2400 KB Output is correct
5 Correct 11 ms 2548 KB Output is correct
6 Correct 18 ms 3960 KB Output is correct
7 Correct 5 ms 1396 KB Output is correct
8 Correct 11 ms 2516 KB Output is correct
9 Correct 12 ms 2760 KB Output is correct
10 Correct 20 ms 4560 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 1876 KB Output is correct
2 Correct 8 ms 1876 KB Output is correct
3 Correct 20 ms 4052 KB Output is correct
4 Correct 6 ms 1364 KB Output is correct
5 Correct 9 ms 1980 KB Output is correct
6 Correct 17 ms 3924 KB Output is correct
7 Correct 8 ms 1668 KB Output is correct
8 Correct 7 ms 1844 KB Output is correct
9 Correct 7 ms 1824 KB Output is correct
10 Correct 8 ms 1716 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 19 ms 4180 KB Output is correct
2 Correct 21 ms 4012 KB Output is correct
3 Correct 16 ms 3668 KB Output is correct
4 Correct 11 ms 2260 KB Output is correct
5 Correct 11 ms 2424 KB Output is correct
6 Correct 11 ms 2516 KB Output is correct
7 Correct 6 ms 1680 KB Output is correct
8 Correct 15 ms 3856 KB Output is correct
9 Correct 11 ms 2260 KB Output is correct
10 Correct 19 ms 4140 KB Output is correct