Submission #777366

# Submission time Handle Problem Language Result Execution time Memory
777366 2023-07-09T07:08:03 Z vjudge1 Sajam (COCI18_sajam) C++17
45 / 90
17 ms 8756 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define OYY 1000000000005
#define faster ios_base::sync_with_stdio(false); cin.tie(NULL);
#define mid (start+end)/2
#define mod 1000000007
int dizi[1005][1005],x[1005][1005];

int32_t main(){
    faster
    int n,k;
    cin>>n>>k;
    char c;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            cin>>c;
            if(c=='o')dizi[i][j]=0;
            else dizi[i][j]=1;
        }
    }
    int tut;
    if(n%2==0)tut=n*n/2+1;
    else tut=n*n/2;
    if(n==1){
        cout<<"DA"<<'\n';
        return 0;
    }
    else if(k>=tut){
        cout<<"DA"<<'\n';
        return 0;
    }
    bool stop=true;
    int cev=0;
    for(int i=1;i<n && stop;i++){
        for(int j=1;j<n && stop;j++){
            int sor=dizi[i-1][j-1]+dizi[i-1][j]+dizi[i][j-1]+dizi[i][j];
            if(sor%2!=0){
                dizi[i][j]^=1;
                cev++;
            }
            if(cev>k){
                stop=false;
                break;
            }
        }
    }
    if(stop)cout<<"DA"<<'\n';
    else cout<<"NE"<<'\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 3 ms 3544 KB Output is correct
3 Correct 4 ms 4564 KB Output is correct
4 Correct 12 ms 7960 KB Output is correct
5 Correct 5 ms 4648 KB Output is correct
6 Correct 2 ms 2516 KB Output is correct
7 Correct 4 ms 4360 KB Output is correct
8 Correct 12 ms 8012 KB Output is correct
9 Correct 1 ms 1628 KB Output is correct
10 Correct 12 ms 8088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 1 ms 596 KB Output is correct
3 Incorrect 1 ms 724 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 6740 KB Output is correct
2 Correct 14 ms 7376 KB Output is correct
3 Correct 7 ms 6032 KB Output is correct
4 Correct 7 ms 5740 KB Output is correct
5 Correct 12 ms 7796 KB Output is correct
6 Correct 5 ms 4820 KB Output is correct
7 Correct 8 ms 6600 KB Output is correct
8 Correct 9 ms 6872 KB Output is correct
9 Correct 4 ms 3404 KB Output is correct
10 Correct 12 ms 8756 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 7628 KB Output is correct
2 Correct 11 ms 7532 KB Output is correct
3 Correct 6 ms 5840 KB Output is correct
4 Correct 8 ms 6576 KB Output is correct
5 Correct 8 ms 6744 KB Output is correct
6 Correct 13 ms 8452 KB Output is correct
7 Correct 4 ms 4208 KB Output is correct
8 Correct 8 ms 6424 KB Output is correct
9 Correct 8 ms 6740 KB Output is correct
10 Correct 16 ms 8652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 5844 KB Output is correct
2 Correct 7 ms 5880 KB Output is correct
3 Incorrect 14 ms 8584 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 15 ms 8652 KB Output is correct
2 Correct 17 ms 8476 KB Output is correct
3 Incorrect 12 ms 8144 KB Output isn't correct
4 Halted 0 ms 0 KB -