Submission #776688

# Submission time Handle Problem Language Result Execution time Memory
776688 2023-07-08T07:13:05 Z vjudge1 Sajam (COCI18_sajam) C++17
45 / 90
7 ms 1364 KB
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5+37;

		
void f(){
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
}

signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
 
	//f();
 	
 	int n, k; cin >> n >> k;

 	vector<string> s(n), t;
 	vector<int> val(n);


 	for(auto &i: s) cin >> i;

 	for(int i=0; i<n; i++){
 		for(int l=0; l<n; l++){
 			val[i]+=((s[i][l]=='x')?1:0);

 		}

 	}

 	int flag=0;

	for(int i=0; i<1; i++){
		vector<int> tf=val;

		for(int l=0; l<n; l++){
			if(s[i][l]=='x'){
				for(int j=0; j<n; j++){
					if(s[j][l]=='x'){
						val[j]--;
					}
					else val[j]++;
				}
			}
		}

		int ans=0;
		for(int l=0; l<n; l++){
			ans+=min(val[l], n-val[l]);
		}
		if(ans<=k) flag=1;
		val=tf;
	}
	
	k--;

/*	for(int i=0; i<n; i++){
		vector<int> tf=val;
		if(s[0][i]=='x') val[0]--;
		else val[0]++;
		s[0][i]=(s[0][i]=='x'?'o':'x');

		for(int l=0; l<n; l++){
			if(s[0][l]=='x'){
				for(int j=0; j<n; j++){
					if(s[j][l]=='x'){
						val[j]--;
					}
					else val[j]++;
				}
			}
		}

		int ans=0;
		for(int l=0; l<n; l++){
			ans+=min(val[l], n-val[l]);
		}
		if(ans<=k) flag=1;
	
		s[0][i]=(s[0][i]=='x'?'o':'x');
			val=tf;

	}

*/
	if(flag) cout<<"DA";
	else cout<<"NE";

}

Compilation message

sajam.cpp: In function 'void f()':
sajam.cpp:7:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |  freopen("in.txt", "r", stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
sajam.cpp:8:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |  freopen("out.txt", "w", stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 468 KB Output is correct
3 Correct 1 ms 596 KB Output is correct
4 Correct 3 ms 1108 KB Output is correct
5 Correct 1 ms 596 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 2 ms 596 KB Output is correct
8 Correct 5 ms 1236 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 7 ms 1236 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 324 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 852 KB Output is correct
2 Correct 3 ms 980 KB Output is correct
3 Correct 2 ms 724 KB Output is correct
4 Correct 1 ms 724 KB Output is correct
5 Correct 3 ms 1108 KB Output is correct
6 Correct 1 ms 596 KB Output is correct
7 Correct 3 ms 852 KB Output is correct
8 Correct 2 ms 980 KB Output is correct
9 Correct 1 ms 468 KB Output is correct
10 Correct 5 ms 1364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1108 KB Output is correct
2 Correct 2 ms 1136 KB Output is correct
3 Correct 1 ms 724 KB Output is correct
4 Correct 2 ms 852 KB Output is correct
5 Correct 2 ms 852 KB Output is correct
6 Correct 3 ms 1236 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 2 ms 852 KB Output is correct
9 Correct 3 ms 852 KB Output is correct
10 Correct 5 ms 1364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 724 KB Output is correct
2 Correct 2 ms 724 KB Output is correct
3 Incorrect 3 ms 1364 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1364 KB Output is correct
2 Correct 4 ms 1348 KB Output is correct
3 Incorrect 4 ms 1236 KB Output isn't correct
4 Halted 0 ms 0 KB -