Submission #884168

# Submission time Handle Problem Language Result Execution time Memory
884168 2023-12-06T16:35:41 Z vjudge1 Sajam (COCI18_sajam) C++17
45 / 90
14 ms 9108 KB
#pragma GCC optimize("unroll-loops,Ofast,O3")
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define spc << " " <<
#define endl "\n"
#define all(x) x.begin(), x.end()
#define int long long
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<ii>
#define st first
#define nd second
#define inf 1000000009
#define MOD 998244353
#define lim 200005
using namespace std;





void solve(){
    int n, k; cin >> n >> k;
    int arr[n+1][n+1];
    for(int i=1; i<=n; i++){
        string s; cin >> s;
        for(int j=1; j<=n; j++){
            if(s[j-1]=='o') arr[i][j]=1;
            else arr[i][j]=0;
        }
    }
    int color[2][n+1];
    color[0][1]=0;
    for(int i=1; i<=n; i++){
        color[1][i] = arr[1][i];
        //cerr << "column" spc i spc color[1][i] << endl;
    }
    for(int i=1; i<=n; i++){
        color[0][i] = (arr[i][1]==1)?(1-color[1][1]):(color[1][1]);
        //cerr << "row" spc i spc color[0][i] << endl;
    }
    int ans=0;
    for(int i=1; i<=n; i++){
        for(int j=1; j<=n; j++){
            if((color[0][i]!=color[1][j])!=arr[i][j])ans++;
        }
    }
    cerr << ans << endl;
    if(ans<=k) cout << "DA" << endl;
    else cout << "NE" << endl;
}



signed main(){
    ios_base::sync_with_stdio(false);cin.tie(0);
    #ifdef Local
    freopen("in","r",stdin);
    freopen("out","w",stdout);
    #endif

    /*freopen("fcolor.in","r",stdin);
    freopen("fcolor.out","w",stdout);*/

    int t=1;
    //cin >> t;
    while(t--) solve();
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 2 ms 1628 KB Output is correct
3 Correct 2 ms 2396 KB Output is correct
4 Correct 6 ms 6748 KB Output is correct
5 Correct 2 ms 2396 KB Output is correct
6 Correct 1 ms 1116 KB Output is correct
7 Correct 4 ms 2392 KB Output is correct
8 Correct 12 ms 7228 KB Output is correct
9 Correct 1 ms 604 KB Output is correct
10 Correct 12 ms 7260 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 4700 KB Output is correct
2 Correct 5 ms 6516 KB Output is correct
3 Correct 3 ms 4440 KB Output is correct
4 Correct 4 ms 4188 KB Output is correct
5 Correct 6 ms 7624 KB Output is correct
6 Correct 2 ms 2908 KB Output is correct
7 Correct 4 ms 5212 KB Output is correct
8 Correct 4 ms 5668 KB Output is correct
9 Correct 3 ms 1884 KB Output is correct
10 Correct 14 ms 9024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 6236 KB Output is correct
2 Correct 5 ms 6748 KB Output is correct
3 Correct 3 ms 4188 KB Output is correct
4 Correct 4 ms 5228 KB Output is correct
5 Correct 4 ms 5344 KB Output is correct
6 Correct 7 ms 8712 KB Output is correct
7 Correct 2 ms 2392 KB Output is correct
8 Correct 4 ms 4956 KB Output is correct
9 Correct 8 ms 5464 KB Output is correct
10 Correct 14 ms 9108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 3672 KB Output is correct
2 Correct 3 ms 3676 KB Output is correct
3 Incorrect 6 ms 8028 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 8280 KB Output is correct
2 Correct 6 ms 7772 KB Output is correct
3 Incorrect 6 ms 7260 KB Output isn't correct
4 Halted 0 ms 0 KB -