답안 #777357

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
777357 2023-07-09T06:53:30 Z vjudge1 Sajam (COCI18_sajam) C++17
15 / 90
16 ms 8148 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;
        }
    }
    if(n==1){
        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;
            }
        }
    }
    int y=2;
    bool sto=true;
    while(y--){
    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;
            }
        }
    }
    }
    //cout<<sto<<" "<<stop<<endl;
    if(stop || sto)cout<<"DA"<<'\n';
    else cout<<"NE"<<'\n';
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 4 ms 3412 KB Output is correct
3 Correct 5 ms 4308 KB Output is correct
4 Correct 12 ms 7380 KB Output is correct
5 Correct 5 ms 4308 KB Output is correct
6 Correct 2 ms 2388 KB Output is correct
7 Correct 4 ms 4180 KB Output is correct
8 Correct 13 ms 7604 KB Output is correct
9 Correct 1 ms 1620 KB Output is correct
10 Correct 11 ms 7660 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 -
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 6228 KB Output is correct
2 Correct 11 ms 6868 KB Output is correct
3 Correct 8 ms 5688 KB Output is correct
4 Correct 7 ms 5260 KB Output is correct
5 Correct 12 ms 7380 KB Output is correct
6 Incorrect 6 ms 4564 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 7124 KB Output is correct
2 Correct 12 ms 7032 KB Output is correct
3 Correct 7 ms 5332 KB Output is correct
4 Correct 9 ms 6028 KB Output is correct
5 Correct 10 ms 6236 KB Output is correct
6 Incorrect 14 ms 7940 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 5332 KB Output is correct
2 Correct 7 ms 5368 KB Output is correct
3 Incorrect 14 ms 8148 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 8148 KB Output is correct
2 Correct 15 ms 7892 KB Output is correct
3 Incorrect 11 ms 7552 KB Output isn't correct
4 Halted 0 ms 0 KB -