답안 #776620

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
776620 2023-07-08T06:03:03 Z vjudge1 Sajam (COCI18_sajam) C++17
45 / 90
2583 ms 5492 KB
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5+37;
vector<int> s(N), v(N);
vector<array<int, 2>> adj[N];
 
		
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<n; 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;
	}

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

}

Compilation message

sajam.cpp: In function 'void f()':
sajam.cpp:9:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |  freopen("in.txt", "r", stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
sajam.cpp:10:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |  freopen("out.txt", "w", stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3412 KB Output is correct
2 Correct 48 ms 3796 KB Output is correct
3 Correct 82 ms 4016 KB Output is correct
4 Correct 469 ms 5160 KB Output is correct
5 Correct 87 ms 3924 KB Output is correct
6 Correct 22 ms 3668 KB Output is correct
7 Correct 292 ms 3996 KB Output is correct
8 Correct 2171 ms 5240 KB Output is correct
9 Correct 31 ms 3460 KB Output is correct
10 Correct 2222 ms 5276 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3412 KB Output is correct
2 Correct 2 ms 3484 KB Output is correct
3 Incorrect 2 ms 3476 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 275 ms 4564 KB Output is correct
2 Correct 360 ms 4888 KB Output is correct
3 Correct 203 ms 4384 KB Output is correct
4 Correct 159 ms 4308 KB Output is correct
5 Correct 480 ms 5132 KB Output is correct
6 Correct 100 ms 4060 KB Output is correct
7 Correct 249 ms 4564 KB Output is correct
8 Correct 296 ms 4700 KB Output is correct
9 Correct 170 ms 3800 KB Output is correct
10 Correct 2582 ms 5488 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 430 ms 5008 KB Output is correct
2 Correct 408 ms 5008 KB Output is correct
3 Correct 174 ms 4308 KB Output is correct
4 Correct 258 ms 4576 KB Output is correct
5 Correct 278 ms 4564 KB Output is correct
6 Correct 585 ms 5292 KB Output is correct
7 Correct 66 ms 3924 KB Output is correct
8 Correct 230 ms 4512 KB Output is correct
9 Correct 1156 ms 4640 KB Output is correct
10 Correct 2583 ms 5492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 195 ms 4328 KB Output is correct
2 Correct 209 ms 4340 KB Output is correct
3 Incorrect 684 ms 5460 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 699 ms 5416 KB Output is correct
2 Correct 646 ms 5412 KB Output is correct
3 Incorrect 591 ms 5248 KB Output isn't correct
4 Halted 0 ms 0 KB -