Submission #512497

# Submission time Handle Problem Language Result Execution time Memory
512497 2022-01-16T12:17:10 Z wildturtle Sajam (COCI18_sajam) C++14
45 / 90
306 ms 3276 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[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";
}

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++) {
      |                    ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 328 KB Output is correct
2 Correct 28 ms 836 KB Output is correct
3 Correct 40 ms 1132 KB Output is correct
4 Correct 118 ms 2096 KB Output is correct
5 Correct 39 ms 1076 KB Output is correct
6 Correct 21 ms 588 KB Output is correct
7 Correct 37 ms 1080 KB Output is correct
8 Correct 141 ms 2152 KB Output is correct
9 Correct 8 ms 468 KB Output is correct
10 Correct 127 ms 2236 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Incorrect 2 ms 332 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 83 ms 1596 KB Output is correct
2 Correct 101 ms 1828 KB Output is correct
3 Correct 78 ms 1496 KB Output is correct
4 Correct 67 ms 1484 KB Output is correct
5 Correct 122 ms 2076 KB Output is correct
6 Correct 46 ms 1108 KB Output is correct
7 Correct 78 ms 1608 KB Output is correct
8 Correct 89 ms 1728 KB Output is correct
9 Correct 25 ms 704 KB Output is correct
10 Correct 144 ms 3264 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 146 ms 2032 KB Output is correct
2 Correct 108 ms 1944 KB Output is correct
3 Correct 58 ms 1356 KB Output is correct
4 Correct 103 ms 1508 KB Output is correct
5 Correct 81 ms 1740 KB Output is correct
6 Correct 141 ms 3076 KB Output is correct
7 Correct 41 ms 812 KB Output is correct
8 Correct 73 ms 1484 KB Output is correct
9 Correct 92 ms 1672 KB Output is correct
10 Correct 152 ms 3140 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 116 ms 1360 KB Output is correct
2 Correct 110 ms 1356 KB Output is correct
3 Incorrect 274 ms 3236 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 259 ms 3276 KB Output is correct
2 Correct 306 ms 3200 KB Output is correct
3 Incorrect 228 ms 2164 KB Output isn't correct
4 Halted 0 ms 0 KB -