답안 #512503

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
512503 2022-01-16T12:18:54 Z wildturtle Sajam (COCI18_sajam) C++14
90 / 90
292 ms 3172 KB
#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[1][j]==0) A[1][j]=1;
            else A[1][j]=0;
            minn=min(minn,go(1)+1);
            if(A[1][j]==0) A[1][j]=1;
            else A[1][j]=0;
        }
    }
    if(minn<=k) cout<<"DA";
    else cout<<"NE";
}

Compilation message

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++) {
      |                    ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 26 ms 460 KB Output is correct
3 Correct 39 ms 796 KB Output is correct
4 Correct 150 ms 1212 KB Output is correct
5 Correct 41 ms 844 KB Output is correct
6 Correct 20 ms 504 KB Output is correct
7 Correct 38 ms 840 KB Output is correct
8 Correct 184 ms 1308 KB Output is correct
9 Correct 8 ms 332 KB Output is correct
10 Correct 149 ms 1320 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 3 ms 332 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 2 ms 332 KB Output is correct
6 Correct 2 ms 332 KB Output is correct
7 Correct 3 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 2 ms 328 KB Output is correct
10 Correct 2 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 82 ms 1116 KB Output is correct
2 Correct 128 ms 1200 KB Output is correct
3 Correct 76 ms 1108 KB Output is correct
4 Correct 58 ms 1012 KB Output is correct
5 Correct 124 ms 1292 KB Output is correct
6 Correct 50 ms 884 KB Output is correct
7 Correct 120 ms 1056 KB Output is correct
8 Correct 89 ms 1144 KB Output is correct
9 Correct 27 ms 568 KB Output is correct
10 Correct 173 ms 2300 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 116 ms 1244 KB Output is correct
2 Correct 114 ms 1224 KB Output is correct
3 Correct 61 ms 1004 KB Output is correct
4 Correct 99 ms 1100 KB Output is correct
5 Correct 86 ms 1152 KB Output is correct
6 Correct 140 ms 2252 KB Output is correct
7 Correct 57 ms 596 KB Output is correct
8 Correct 80 ms 972 KB Output is correct
9 Correct 86 ms 1116 KB Output is correct
10 Correct 139 ms 2304 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 116 ms 1012 KB Output is correct
2 Correct 114 ms 1012 KB Output is correct
3 Correct 286 ms 2288 KB Output is correct
4 Correct 88 ms 1180 KB Output is correct
5 Correct 111 ms 1436 KB Output is correct
6 Correct 259 ms 3172 KB Output is correct
7 Correct 81 ms 1088 KB Output is correct
8 Correct 81 ms 1228 KB Output is correct
9 Correct 87 ms 1248 KB Output is correct
10 Correct 99 ms 1216 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 254 ms 2320 KB Output is correct
2 Correct 250 ms 2288 KB Output is correct
3 Correct 292 ms 1380 KB Output is correct
4 Correct 140 ms 1608 KB Output is correct
5 Correct 142 ms 1624 KB Output is correct
6 Correct 154 ms 1672 KB Output is correct
7 Correct 75 ms 1184 KB Output is correct
8 Correct 212 ms 1956 KB Output is correct
9 Correct 112 ms 1404 KB Output is correct
10 Correct 247 ms 2244 KB Output is correct