Submission #777380

# Submission time Handle Problem Language Result Execution time Memory
777380 2023-07-09T07:33:00 Z vjudge1 Sajam (COCI18_sajam) C++17
45 / 90
128 ms 9092 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;bool sto=true;
    int y=100;
    while(y--){
    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;
            }
        }
    }
    int cev1=0;
    for(int i=1;i<n && sto;i++){
        for(int j=1;j<n && sto;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-1][j-1]^=1;
                cev1++;
            }
            if(cev1>k){
                sto=false;
                break;
            }
        }
    }
    if(stop && sto){
        cout<<"DA"<<'\n';
        return 0;
    }
    }
    cout<<"NE"<<'\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 4 ms 3540 KB Output is correct
3 Correct 7 ms 4564 KB Output is correct
4 Correct 12 ms 8288 KB Output is correct
5 Correct 5 ms 4692 KB Output is correct
6 Correct 2 ms 2516 KB Output is correct
7 Correct 4 ms 4444 KB Output is correct
8 Correct 11 ms 8532 KB Output is correct
9 Correct 2 ms 1620 KB Output is correct
10 Correct 11 ms 8532 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 11 ms 6656 KB Output is correct
2 Correct 11 ms 7508 KB Output is correct
3 Correct 7 ms 6100 KB Output is correct
4 Correct 7 ms 5724 KB Output is correct
5 Correct 12 ms 8148 KB Output is correct
6 Correct 41 ms 4788 KB Output is correct
7 Correct 77 ms 6688 KB Output is correct
8 Correct 82 ms 6996 KB Output is correct
9 Correct 3 ms 3284 KB Output is correct
10 Correct 12 ms 9024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 17 ms 7792 KB Output is correct
2 Correct 12 ms 7692 KB Output is correct
3 Correct 7 ms 5796 KB Output is correct
4 Correct 8 ms 6616 KB Output is correct
5 Correct 9 ms 6872 KB Output is correct
6 Correct 128 ms 8844 KB Output is correct
7 Correct 32 ms 4168 KB Output is correct
8 Correct 72 ms 6488 KB Output is correct
9 Correct 11 ms 6788 KB Output is correct
10 Correct 12 ms 9012 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 5844 KB Output is correct
2 Correct 7 ms 5804 KB Output is correct
3 Incorrect 13 ms 8908 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 14 ms 9092 KB Output is correct
2 Correct 14 ms 8780 KB Output is correct
3 Incorrect 12 ms 8424 KB Output isn't correct
4 Halted 0 ms 0 KB -