답안 #777381

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
777381 2023-07-09T07:34:00 Z vjudge1 Sajam (COCI18_sajam) C++17
45 / 90
100 ms 8192 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;

    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;
            }
        }
    }
     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;
            }
        }
    }
    if(stop && sto){
        cout<<"DA"<<'\n';
        return 0;
    }
    }
    cout<<"NE"<<'\n';
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 3 ms 3412 KB Output is correct
3 Correct 4 ms 4308 KB Output is correct
4 Correct 12 ms 7408 KB Output is correct
5 Correct 5 ms 4408 KB Output is correct
6 Correct 2 ms 2388 KB Output is correct
7 Correct 4 ms 4180 KB Output is correct
8 Correct 12 ms 7636 KB Output is correct
9 Correct 1 ms 1620 KB Output is correct
10 Correct 11 ms 7712 KB Output is correct
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 6140 KB Output is correct
2 Correct 10 ms 6868 KB Output is correct
3 Correct 7 ms 5616 KB Output is correct
4 Correct 6 ms 5332 KB Output is correct
5 Correct 11 ms 7380 KB Output is correct
6 Correct 32 ms 4564 KB Output is correct
7 Correct 60 ms 6100 KB Output is correct
8 Correct 65 ms 6356 KB Output is correct
9 Correct 3 ms 3156 KB Output is correct
10 Correct 12 ms 8008 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 7124 KB Output is correct
2 Correct 11 ms 6996 KB Output is correct
3 Correct 7 ms 5332 KB Output is correct
4 Correct 8 ms 6100 KB Output is correct
5 Correct 9 ms 6228 KB Output is correct
6 Correct 100 ms 7924 KB Output is correct
7 Correct 25 ms 3964 KB Output is correct
8 Correct 57 ms 5972 KB Output is correct
9 Correct 8 ms 6396 KB Output is correct
10 Correct 12 ms 8028 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 5444 KB Output is correct
2 Correct 7 ms 5428 KB Output is correct
3 Incorrect 13 ms 8020 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 8192 KB Output is correct
2 Correct 15 ms 8004 KB Output is correct
3 Incorrect 11 ms 7652 KB Output isn't correct
4 Halted 0 ms 0 KB -