제출 #102456

#제출 시각아이디문제언어결과실행 시간메모리
102456BanFccSajam (COCI18_sajam)C++14
90 / 90
85 ms5376 KiB
#include<bits/stdc++.h>
#define mp make_pair
#define fi first
#define se second
#define debug(x) cerr<<#x<<" = "<<(x)<<endl
#define eps 1e-8
#define pi acos(-1.0)
using namespace std;
void test(){cerr<<"\n";}
template<typename T,typename... Args>void test(T x,Args... args){cerr<<x<<" ";test(args...);}
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int MAXN=(int)1e5+5;
const int MOD=(int)1e9+7;
char str[1005];
bitset<1005>b[1005];
int a[1005][1005];
int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++){
        scanf("%s",str);
        for(int j=0;j<n;j++){
            b[i][j]=(str[j]=='o');
        }
    }
    for(int i=1;i<=n;i++){
        for(int j=i+1;j<=n;j++){
            a[i][j]=a[j][i]=n-(b[i]^b[j]).count();
        }
    }
    int flag=0;
    for(int i=1;i<=n;i++){
        int stp=0;
        for(int j=1;j<=n;j++){
            if(i==j)continue;
            stp+=min(n-a[i][j],a[i][j]);
        }
        if(stp<=k){
            flag=1;
            break;
        }
    }
    if(k==n&&flag==0){
        for(int i=0;i<n;i++){
            int f=1;
            for(int j=2;j<=n;j++){
                int tmp=a[1][j];
                if(b[1][i]!=b[j][i])tmp++;
                else tmp--;
                if(tmp!=1&&tmp!=n-1)f=0;
            }
            if(f){
                flag=1;
                break;
            }
        }

    }
    if(flag)printf("DA\n");
    else printf("NE\n");
    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

sajam.cpp: In function 'int main()':
sajam.cpp:22:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&n,&k);
     ~~~~~^~~~~~~~~~~~~~
sajam.cpp:24:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%s",str);
         ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...