이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define ll long long
#define f first
#define sc second
#define pb push_back
using namespace std;
ll a,b,c,d,i,e,f,g,n,m,k,l,minn;
bitset<1000> A[1000];
string s[1003];
ll xorr(bitset<1000> x, bitset<1000> y){return min((ll)(x^y).count(), (ll)(n-(x^y).count()));}
ll go(ll x) {
ll cur=0;
for(ll i=1;i<=n;i++) {
if(i==x) continue;
cur+=xorr(A[i],A[x]);
}
return cur;
}
int main() {
cin>>n>>k;
for(ll i=1;i<=n;i++) {
cin>>s[i];
for(ll j=0;j<s[i].size();j++) {
A[i][j]=(s[i][j]=='x');
}
}
minn=1e18;
for(ll i=1;i<=n;i++) {
minn=min(minn,go(i));
}
if(n==k) {
for(ll j=0;j<n;j++) {
if(A[i][j]==0) A[i][j]=1;
else A[i][j]=0;
minn=min(minn,go(i)+1);
if(A[i][j]==0) A[i][j]=1;
else A[i][j]=0;
}
}
if(minn<=k) cout<<"DA";
else cout<<"NE";
}
컴파일 시 표준 에러 (stderr) 메시지
sajam.cpp: In function 'int main()':
sajam.cpp:23:21: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
23 | for(ll j=0;j<s[i].size();j++) {
| ~^~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |